Beispiel #1
0
 def test_handler_full_setup(self):
     """Test that the handler ends up calling the renderers"""
     cfg = self._get_base_config_repos()
     cfg['zypper']['config'] = {
         'download.deltarpm': 'False',
     }
     root_d = self.tmp_dir()
     os.makedirs('%s/etc/zypp/repos.d' % root_d)
     helpers.populate_dir(root_d, {self.zypp_conf: '# Zypp config\n'})
     self.reRoot(root_d)
     cc_zypper_add_repo.handle('zypper_add_repo', cfg, None, LOG, [])
     cfg_out = os.path.join(root_d, self.zypp_conf)
     contents = util.load_file(cfg_out)
     expected = [
         '# Zypp config',
         '# Added via cloud.cfg',
         'download.deltarpm=False',
     ]
     for item in contents.split('\n'):
         if item not in expected:
             self.assertIsNone(item)
     repos = glob.glob('%s/etc/zypp/repos.d/*.repo' % root_d)
     expected_repos = ['testing-foo.repo', 'testing-bar.repo']
     if len(repos) != 2:
         assert 'Number of repos written is "%d" expected 2' % len(repos)
     for repo in repos:
         repo_name = os.path.basename(repo)
         if repo_name not in expected_repos:
             assert 'Found repo with name "%s"; unexpected' % repo_name
 def test_handler_full_setup(self):
     """Test that the handler ends up calling the renderers"""
     cfg = self._get_base_config_repos()
     cfg['zypper']['config'] = {
         'download.deltarpm': 'False',
     }
     root_d = self.tmp_dir()
     os.makedirs('%s/etc/zypp/repos.d' % root_d)
     helpers.populate_dir(root_d, {self.zypp_conf: '# Zypp config\n'})
     self.reRoot(root_d)
     cc_zypper_add_repo.handle('zypper_add_repo', cfg, None, LOG, [])
     cfg_out = os.path.join(root_d, self.zypp_conf)
     contents = util.load_file(cfg_out)
     expected = [
         '# Zypp config',
         '# Added via cloud.cfg',
         'download.deltarpm=False',
     ]
     for item in contents.split('\n'):
         if item not in expected:
             self.assertIsNone(item)
     repos = glob.glob('%s/etc/zypp/repos.d/*.repo' % root_d)
     expected_repos = ['testing-foo.repo', 'testing-bar.repo']
     if len(repos) != 2:
         assert 'Number of repos written is "%d" expected 2' % len(repos)
     for repo in repos:
         repo_name = os.path.basename(repo)
         if repo_name not in expected_repos:
             assert 'Found repo with name "%s"; unexpected' % repo_name