def tearDown(self): """Clean up Mirror mockup.""" __builtins__.open = MockFile._ORIG rmtree(self.base_dir, ignore_errors=True) del self.base_dir del self.m MockConfigRegistry._EXTRA = {} MockUCSHttpServer.mock_reset() MockPopen.mock_reset()
def structs(): """Mockups for called scripts.""" server = MockUCSHttpServer('server') struct_r = U.UCSRepoPool5(major=MAJOR, minor=MINOR, patchlevel=PATCH) preup_r = struct_r.path('preup.sh') postup_r = struct_r.path('postup.sh') struct_c = U.UCSRepoPool(major=MAJOR, minor=MINOR, part='%s/component' % (PART, ), patch='c', arch=ARCH) preup_c = struct_c.path('preup.sh') postup_c = struct_c.path('postup.sh') yield (server, struct_r, 'preup', preup_r, 'r_pre') yield (server, struct_r, 'postup', postup_r, 'r_post') yield (server, struct_c, 'preup', preup_c, 'c_pre') yield (server, struct_c, 'postup', postup_c, 'c_post')
def test_get_sh_files_bug27149(self): """Test preup.sh / postup.sh download for non-architecture component.""" server = MockUCSHttpServer('server') struct = U.UCSRepoPoolNoArch(major=MAJOR, minor=MINOR, part='%s/component' % (PART, ), patch='a') preup_path = struct.path('preup.sh') server.mock_add(preup_path, '#!preup_content') postup_path = struct.path('postup.sh') server.mock_add(postup_path, '#!postup_content') repo = ((server, struct), ) gen = U.UniventionUpdater.get_sh_files(repo) self.assertEqual( (server, struct, 'preup', preup_path, '#!preup_content'), gen.next()) self.assertEqual( (server, struct, 'postup', postup_path, '#!postup_content'), gen.next()) self.assertRaises(StopIteration, gen.next)
def test_get_sh_files(self): """Test preup.sh / postup.sh download.""" server = MockUCSHttpServer('server') struct = U.UCSRepoPool5(major=MAJOR, minor=MINOR, part=PART, patchlevel=PATCH, arch=ARCH) preup_path = struct.path('preup.sh') server.mock_add(preup_path, '#!preup_content') postup_path = struct.path('postup.sh') server.mock_add(postup_path, '#!postup_content') repo = ((server, struct), ) gen = U.UniventionUpdater.get_sh_files(repo) self.assertEqual( (server, struct, 'preup', preup_path, '#!preup_content'), gen.next()) self.assertEqual( (server, struct, 'postup', postup_path, '#!postup_content'), gen.next()) self.assertRaises(StopIteration, gen.next)
def _uri(self, uris): """Fill URI mockup.""" for key, value in uris.items(): MockUCSHttpServer.mock_add(key, value)
def tearDown(self): """Clean up Updater mockup.""" del self.u MockConfigRegistry._EXTRA = {} MockUCSHttpServer.mock_reset() MockPopen.mock_reset()