From 1034cfd9a76b2a58a479f9c8de0f196ac8450a0d Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 30 May 2018 09:48:37 -0700 Subject: [PATCH] Make sure new sources show up in the source/list output Also remove an unneeded makedirs from test_server.py --- tests/pylorax/test_server.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/pylorax/test_server.py b/tests/pylorax/test_server.py index 752c858f..c50b2387 100644 --- a/tests/pylorax/test_server.py +++ b/tests/pylorax/test_server.py @@ -52,7 +52,6 @@ class ServerTestCase(unittest.TestCase): # copy over the test dnf repositories dnf_repo_dir = server.config["COMPOSER_CFG"].get("composer", "repo_dir") - os.makedirs(dnf_repo_dir) for f in glob("./tests/pylorax/repos/*.repo"): shutil.copy2(f, dnf_repo_dir) @@ -507,6 +506,13 @@ class ServerTestCase(unittest.TestCase): data = json.loads(resp.data) self.assertEqual(data, {"status":True}) + # Is it listed? + resp = self.server.get("/api/v0/projects/source/list") + data = json.loads(resp.data) + self.assertNotEqual(data, None) + sources = data["sources"] + self.assertTrue("new-repo-1" in sources) + def test_projects_source_00_new_toml(self): """Test /api/v0/projects/source/new with a new toml source""" toml_source = open("./tests/pylorax/source/test-repo.toml").read() @@ -517,6 +523,13 @@ class ServerTestCase(unittest.TestCase): data = json.loads(resp.data) self.assertEqual(data, {"status":True}) + # Is it listed? + resp = self.server.get("/api/v0/projects/source/list") + data = json.loads(resp.data) + self.assertNotEqual(data, None) + sources = data["sources"] + self.assertTrue("new-repo-2" in sources) + def test_projects_source_00_replace(self): """Test /api/v0/projects/source/new with a replacement source""" toml_source = open("./tests/pylorax/source/replace-repo.toml").read()