Make sure new sources show up in the source/list output

Also remove an unneeded makedirs from test_server.py
This commit is contained in:
Brian C. Lane 2018-05-30 09:48:37 -07:00
parent 23f4b2a3ec
commit 1034cfd9a7
1 changed files with 14 additions and 1 deletions

View File

@ -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()