Esempio n. 1
0
 def test_get_client(self):
     with mock.module_exists(*_redis_modules()):
         conn = Connection(transport=Transport)
         chan = conn.channel()
         assert chan.Client
         assert chan.ResponseError
         assert conn.transport.connection_errors
         assert conn.transport.channel_errors
Esempio n. 2
0
    def test_fixup(self, patching):
        with patch('celery.fixups.django.DjangoFixup') as Fixup:
            patching.setenv('DJANGO_SETTINGS_MODULE', '')
            fixup(self.app)
            Fixup.assert_not_called()

            patching.setenv('DJANGO_SETTINGS_MODULE', 'settings')
            with mock.mask_modules('django'):
                with pytest.warns(FixupWarning):
                    fixup(self.app)
                Fixup.assert_not_called()
            with mock.module_exists('django'):
                fixup(self.app)
                Fixup.assert_called()