def stub_out_registry_image_update(stubs): """ Stubs an image update on the registry. :param stubs: Set of stubout stubs """ test_stubs.stub_out_registry_server(stubs) def fake_image_update(ctx, image_id, values, purge_props=False): return {'properties': {}} stubs.Set(db_api, 'image_update', fake_image_update)
def setUp(self): self.cache_dir = os.path.join("/", "tmp", "test.cache.%d" % random.randint(0, 1000000)) self.filesystem_store_datadir = os.path.join(self.cache_dir, 'filestore') self.options = { 'verbose': True, 'debug': True, 'image_cache_datadir': self.cache_dir, 'registry_host': '0.0.0.0', 'registry_port': 9191, 'default_store': 'file', 'filesystem_store_datadir': self.filesystem_store_datadir } self.cache_filter = cache.CacheFilter( server.API(self.options), self.options) self.api = context.ContextMiddleware(self.cache_filter, self.options) self.stubs = stubout.StubOutForTesting() stubs.stub_out_registry_server(self.stubs)