Beispiel #1
0
 def test_pylibmc_bytes_key(self):
     with mock.reset_modules('celery.backends.cache'):
         with self.mock_pylibmc():
             from celery.backends import cache
             cache._imp = [None]
             task_id, result = str_to_bytes(uuid()), 42
             b = cache.CacheBackend(backend='memcache', app=self.app)
             b.store_result(task_id, result, state=states.SUCCESS)
             assert b.get_result(task_id) == result
Beispiel #2
0
 def test_memcache_unicode_key(self, mask_modules):
     with self.mock_memcache():
         with conftest.reset_modules('celery.backends.cache'):
             from celery.backends import cache
             cache._imp = [None]
             task_id, result = str(uuid()), 42
             b = cache.CacheBackend(backend='memcache', app=self.app)
             b.store_result(task_id, result, state=states.SUCCESS)
             assert b.get_result(task_id) == result
Beispiel #3
0
 def test_pylibmc_unicode_key(self):
     with reset_modules('celery.backends.cache'):
         with self.mock_pylibmc():
             from celery.backends import cache
             cache._imp = [None]
             task_id, result = string(uuid()), 42
             b = cache.CacheBackend(backend='memcache', app=self.app)
             b.store_result(task_id, result, status=states.SUCCESS)
             self.assertEqual(b.get_result(task_id), result)
Beispiel #4
0
 def test_memcache_bytes_key(self):
     with self.mock_memcache():
         with reset_modules('celery.backends.cache'):
             with mask_modules('pylibmc'):
                 from celery.backends import cache
                 cache._imp = [None]
                 task_id, result = str_to_bytes(uuid()), 42
                 b = cache.CacheBackend(backend='memcache')
                 b.store_result(task_id, result, status=states.SUCCESS)
                 self.assertEqual(b.get_result(task_id), result)