(self, Certificate, glob, isdir)
| 82 | @patch('glob.glob') |
| 83 | @patch('celery.security.certificate.Certificate') |
| 84 | def test_init(self, Certificate, glob, isdir): |
| 85 | cert = Certificate.return_value = Mock() |
| 86 | cert.has_expired.return_value = False |
| 87 | isdir.return_value = True |
| 88 | glob.return_value = ['foo.cert'] |
| 89 | with conftest.open(): |
| 90 | cert.get_id.return_value = 1 |
| 91 | |
| 92 | path = os.path.join('var', 'certs') |
| 93 | x = FSCertStore(path) |
| 94 | assert 1 in x._certs |
| 95 | glob.assert_called_with(os.path.join(path, '*')) |
| 96 | |
| 97 | # they both end up with the same id |
| 98 | glob.return_value = ['foo.cert', 'bar.cert'] |
| 99 | with pytest.raises(SecurityError): |
| 100 | x = FSCertStore(path) |
| 101 | glob.return_value = ['foo.cert'] |
| 102 | |
| 103 | cert.has_expired.return_value = True |
| 104 | with pytest.raises(SecurityError): |
| 105 | x = FSCertStore(path) |
| 106 | |
| 107 | isdir.return_value = False |
| 108 | with pytest.raises(SecurityError): |
| 109 | x = FSCertStore(path) |
nothing calls this directly
no test coverage detected