def test_no_config_section_no_new_data(self):
     """When there is no config section no new data should be written to
        zypp.conf"""
     cfg = self._get_base_config_repos()
     root_d = self.tmp_dir()
     helpers.populate_dir(root_d, {self.zypp_conf: '# No data'})
     self.reRoot(root_d)
     cc_zypper_add_repo._write_zypp_config(cfg.get('config', {}))
     cfg_out = os.path.join(root_d, self.zypp_conf)
     contents = util.load_file(cfg_out)
     self.assertEqual(contents, '# No data')
Example #2
0
 def test_no_config_section_no_new_data(self):
     """When there is no config section no new data should be written to
        zypp.conf"""
     cfg = self._get_base_config_repos()
     root_d = self.tmp_dir()
     helpers.populate_dir(root_d, {self.zypp_conf: '# No data'})
     self.reRoot(root_d)
     cc_zypper_add_repo._write_zypp_config(cfg.get('config', {}))
     cfg_out = os.path.join(root_d, self.zypp_conf)
     contents = util.load_file(cfg_out)
     self.assertEqual(contents, '# No data')
Example #3
0
 def test_empty_config_value_no_new_data(self):
     """When the config section is not empty but there are no values
        no new data should be written to zypp.conf"""
     cfg = self._get_base_config_repos()
     cfg['zypper']['config'] = {'download.deltarpm': None}
     root_d = self.tmp_dir()
     helpers.populate_dir(root_d, {self.zypp_conf: '# No data'})
     self.reRoot(root_d)
     cc_zypper_add_repo._write_zypp_config(cfg.get('config', {}))
     cfg_out = os.path.join(root_d, self.zypp_conf)
     contents = util.load_file(cfg_out)
     self.assertEqual(contents, '# No data')
Example #4
0
 def test_empty_config_section_no_new_data(self):
     """When the config section is empty no new data should be written to
     zypp.conf"""
     cfg = self._get_base_config_repos()
     cfg["zypper"]["config"] = None
     root_d = self.tmp_dir()
     helpers.populate_dir(root_d, {self.zypp_conf: "# No data"})
     self.reRoot(root_d)
     cc_zypper_add_repo._write_zypp_config(cfg.get("config", {}))
     cfg_out = os.path.join(root_d, self.zypp_conf)
     contents = util.load_file(cfg_out)
     self.assertEqual(contents, "# No data")
 def test_empty_config_value_no_new_data(self):
     """When the config section is not empty but there are no values
        no new data should be written to zypp.conf"""
     cfg = self._get_base_config_repos()
     cfg['zypper']['config'] = {
         'download.deltarpm': None
     }
     root_d = self.tmp_dir()
     helpers.populate_dir(root_d, {self.zypp_conf: '# No data'})
     self.reRoot(root_d)
     cc_zypper_add_repo._write_zypp_config(cfg.get('config', {}))
     cfg_out = os.path.join(root_d, self.zypp_conf)
     contents = util.load_file(cfg_out)
     self.assertEqual(contents, '# No data')
Example #6
0
 def test_config_write(self):
     """Write valid configuration data"""
     cfg = {'config': {'download.deltarpm': 'False', 'reposdir': 'foo'}}
     root_d = self.tmp_dir()
     helpers.populate_dir(root_d, {self.zypp_conf: '# Zypp config\n'})
     self.reRoot(root_d)
     cc_zypper_add_repo._write_zypp_config(cfg['config'])
     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', 'reposdir=foo'
     ]
     for item in contents.split('\n'):
         if item not in expected:
             self.assertIsNone(item)
Example #7
0
 def test_config_write(self):
     """Write valid configuration data"""
     cfg = {"config": {"download.deltarpm": "False", "reposdir": "foo"}}
     root_d = self.tmp_dir()
     helpers.populate_dir(root_d, {self.zypp_conf: "# Zypp config\n"})
     self.reRoot(root_d)
     cc_zypper_add_repo._write_zypp_config(cfg["config"])
     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",
         "reposdir=foo",
     ]
     for item in contents.split("\n"):
         if item not in expected:
             self.assertIsNone(item)
 def test_config_write(self):
     """Write valid configuration data"""
     cfg = {
         'config': {
             'download.deltarpm': 'False',
             'reposdir': 'foo'
         }
     }
     root_d = self.tmp_dir()
     helpers.populate_dir(root_d, {self.zypp_conf: '# Zypp config\n'})
     self.reRoot(root_d)
     cc_zypper_add_repo._write_zypp_config(cfg['config'])
     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',
         'reposdir=foo'
     ]
     for item in contents.split('\n'):
         if item not in expected:
             self.assertIsNone(item)