def test_remote_sections(self, mock_get_config_parser): mock_get_config_parser.return_value = self._rf_cfg() rf = config.RepoFile('') remotes = rf.remote_sections() self.assertTrue('remote "awesome-ostree-controller"' in remotes) self.assertFalse('core' in remotes) self.assertFalse('rhsm' in remotes)
def test_remote_sections(self, mock_get_config_parser): mock_get_config_parser.return_value = self._rf_cfg() rf = config.RepoFile() remotes = rf.remote_sections() self.assertFalse('remote "awesmome-ostree-controller"' in remotes) self.assertFalse("core" in remotes) self.assertFalse("rhsm" in remotes) self.assertEqual(remotes, [])
def test_remote_sections(self, mock_get_config_parser): mock_get_config_parser.return_value = self._rf_cfg() rf = config.RepoFile('') remotes = rf.remote_sections() self.assertTrue('remote "awesomeos-7-controller"' in remotes) self.assertFalse('core' in remotes) self.assertFalse('rhsm' in remotes) for remote in remotes: self._verify_remote(self._rf_cfg_instance, remote)
def test_section_is_remote(self, mock_get_config_parser): mock_get_config_parser.return_value = self._rf_cfg() rf = config.RepoFile("") self.assertTrue(rf.section_is_remote('remote "awesome-ostree-controller"')) self.assertTrue(rf.section_is_remote('remote "rhsm-ostree"')) self.assertTrue(rf.section_is_remote('remote "localinstall"')) self.assertFalse(rf.section_is_remote("rhsm")) self.assertFalse(rf.section_is_remote("core")) # string from config file is "false", not boolean False yet self.assertEqual("false", rf.config_parser.get('remote "awesome-ostree-controller"', "gpg-verify"))
def test_section_set_remote(self, mock_get_config_parser): mock_get_config_parser.return_value = self._rf_cfg() rf = config.RepoFile('') remote = model.OstreeRemote() remote.url = "/some/path" remote.name = "awesomeos-remote" remote.gpg_verify = 'true' remote.tls_client_cert_path = "/etc/pki/entitlement/54321.pem" remote.tls_client_key_path = "/etc/pki/entitlement/54321-key.pem" rf.set_remote(remote)
def test_section_set_remote(self, mock_get_config_parser): mock_get_config_parser.return_value = self._rf_cfg() rf = config.RepoFile('') remote = model.OstreeRemote() remote.url = "/some/path" remote.name = "awesomeos-remote" remote.gpg_verify = 'true' remote.tls_client_cert_path = "/etc/pki/entitlement/54321.pem" remote.tls_client_key_path = "/etc/pki/entitlement/54321-key.pem" rf.set_remote(remote) expected_proxy = "http://*****:*****@notaproxy.grimlock.usersys.redhat.com:3128" repo_proxy_uri = rf.config_parser.get('remote "awesomeos-remote"', 'proxy') self.assertEquals(expected_proxy, repo_proxy_uri)
def save(self, ostree_config): if not self.config_file: self.config_file = config.RepoFile(self.config_file_path) writer = OstreeConfigFileWriter(self.config_file) writer.save(ostree_config)
def load(self): self.config_file = config.RepoFile(self.config_file_path) return self.config_file