MCPcopy Create free account
hub / github.com/celery/celery / test_security_conf

Method test_security_conf

t/unit/security/test_security.py:150–169  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

148 registry._set_default_serializer.assert_called_with('auth')
149
150 def test_security_conf(self):
151 self.app.conf.task_serializer = 'auth'
152 with pytest.raises(ImproperlyConfigured):
153 self.app.setup_security()
154
155 self.app.conf.accept_content = ['auth']
156 with pytest.raises(ImproperlyConfigured):
157 self.app.setup_security()
158
159 _import = builtins.__import__
160
161 def import_hook(name, *args, **kwargs):
162 if name == 'cryptography':
163 raise ImportError
164 return _import(name, *args, **kwargs)
165
166 builtins.__import__ = import_hook
167 with pytest.raises(ImproperlyConfigured):
168 self.app.setup_security()
169 builtins.__import__ = _import
170
171 def test_reraise_errors(self):
172 with pytest.raises(SecurityError):

Callers

nothing calls this directly

Calls 2

raisesMethod · 0.80
setup_securityMethod · 0.80

Tested by

no test coverage detected