From a2a0477424f945091e7256939aa8a576bc516600 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Tue, 7 Aug 2018 09:20:16 -0700 Subject: [PATCH] Update get_system_repo for dnf With dnf we iterate the repos and return their names, not the filenames like we do with yum. Also make the list test more flexible. --- tests/pylorax/test_server.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/pylorax/test_server.py b/tests/pylorax/test_server.py index 659c9063..c63e39e0 100644 --- a/tests/pylorax/test_server.py +++ b/tests/pylorax/test_server.py @@ -44,8 +44,7 @@ def get_system_repo(): for section in cfg.sections(): try: if cfg.get(section, "enabled") == "1": - # The API only supports repo filenames, return that. - return os.path.basename(sys_repo)[:-5] + return section except NoOptionError: pass @@ -534,10 +533,9 @@ class ServerTestCase(unittest.TestCase): resp = self.server.get("/api/v0/projects/source/list") data = json.loads(resp.data) self.assertNotEqual(data, None) - if self.rawhide: - self.assertEqual(data["sources"], ["lorax-1", "lorax-2", "lorax-3", "lorax-4", "other-repo", "rawhide", "single-repo"]) - else: - self.assertEqual(data["sources"], ["fedora", "lorax-1", "lorax-2", "lorax-3", "lorax-4", "other-repo", "single-repo", "updates"]) + # Make sure it lists some common sources + for r in ["lorax-1", "lorax-2", "lorax-3", "lorax-4", "other-repo", "single-repo"]: + self.assertTrue(r in data["sources"] ) def test_projects_source_00_info(self): """Test /api/v0/projects/source/info"""