def setUp(self): self.object_cache_patcher = mock.patch.dict( 'robottelo.decorators.OBJECT_CACHE') self.object_cache = self.object_cache_patcher.start() def make_foo(options): return {'id': 42} self.make_foo = decorators.cacheable(make_foo)
def make_foo(self): mocked_object_cache_patcher = mock.patch.dict( 'robottelo.decorators.OBJECT_CACHE') mocked_object_cache_patcher.start() # decorators.cacheable uses the function name as the key, removing make_ def make_foo(options): return {'id': 42} yield decorators.cacheable(make_foo) mocked_object_cache_patcher.stop()