Make sure new sources show up in the source/list output
Also remove an unneeded makedirs from test_server.py
(cherry picked from commit 1034cfd9a7
)
This commit is contained in:
parent
a283ec9582
commit
d9d73a128b
@ -52,7 +52,6 @@ class ServerTestCase(unittest.TestCase):
|
|||||||
|
|
||||||
# copy over the test dnf repositories
|
# copy over the test dnf repositories
|
||||||
dnf_repo_dir = server.config["COMPOSER_CFG"].get("composer", "repo_dir")
|
dnf_repo_dir = server.config["COMPOSER_CFG"].get("composer", "repo_dir")
|
||||||
os.makedirs(dnf_repo_dir)
|
|
||||||
for f in glob("./tests/pylorax/repos/*.repo"):
|
for f in glob("./tests/pylorax/repos/*.repo"):
|
||||||
shutil.copy2(f, dnf_repo_dir)
|
shutil.copy2(f, dnf_repo_dir)
|
||||||
|
|
||||||
@ -507,6 +506,13 @@ class ServerTestCase(unittest.TestCase):
|
|||||||
data = json.loads(resp.data)
|
data = json.loads(resp.data)
|
||||||
self.assertEqual(data, {"status":True})
|
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):
|
def test_projects_source_00_new_toml(self):
|
||||||
"""Test /api/v0/projects/source/new with a new toml source"""
|
"""Test /api/v0/projects/source/new with a new toml source"""
|
||||||
toml_source = open("./tests/pylorax/source/test-repo.toml").read()
|
toml_source = open("./tests/pylorax/source/test-repo.toml").read()
|
||||||
@ -517,6 +523,13 @@ class ServerTestCase(unittest.TestCase):
|
|||||||
data = json.loads(resp.data)
|
data = json.loads(resp.data)
|
||||||
self.assertEqual(data, {"status":True})
|
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):
|
def test_projects_source_00_replace(self):
|
||||||
"""Test /api/v0/projects/source/new with a replacement source"""
|
"""Test /api/v0/projects/source/new with a replacement source"""
|
||||||
toml_source = open("./tests/pylorax/source/replace-repo.toml").read()
|
toml_source = open("./tests/pylorax/source/replace-repo.toml").read()
|
||||||
|
Loading…
Reference in New Issue
Block a user