From 187f15fcf19a55983a650e760ce74dc4d2039129 Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Jul 15 2015 07:57:17 +0000 Subject: [frontend] tests --- diff --git a/frontend/coprs_frontend/coprs/models.py b/frontend/coprs_frontend/coprs/models.py index 4deec0f..077e8a0 100644 --- a/frontend/coprs_frontend/coprs/models.py +++ b/frontend/coprs_frontend/coprs/models.py @@ -274,7 +274,7 @@ class Package(db.Model, helpers.Serializer): copr = db.relationship("Copr", backref=db.backref("packages")) @property - def gist_git_repo(self): + def dist_git_repo(self): return "{}/{}/{}".format(self.copr.owner.name, self.copr.name, self.name) diff --git a/frontend/coprs_frontend/coprs/views/backend_ns/backend_general.py b/frontend/coprs_frontend/coprs/views/backend_ns/backend_general.py index c252bdd..51f15a0 100644 --- a/frontend/coprs_frontend/coprs/views/backend_ns/backend_general.py +++ b/frontend/coprs_frontend/coprs/views/backend_ns/backend_general.py @@ -79,8 +79,7 @@ def dist_git_upload_completed(): return flask.jsonify(result) @backend_ns.route("/waiting/") -# FIXME I'm commented -#@misc.backend_authenticated +@misc.backend_authenticated def waiting(): """ Return list of waiting actions and builds. @@ -109,7 +108,7 @@ def waiting(): "memory_reqs": task.build.memory_reqs, "timeout": task.build.timeout, "enable_net": task.build.enable_net, - "git_repo": task.build.package.gist_git_repo, + "git_repo": task.build.package.dist_git_repo, "git_hash": task.git_hash, "git_branch": helpers.chroot_to_branch(task.mock_chroot.name), } diff --git a/frontend/coprs_frontend/tests/coprs_test_case.py b/frontend/coprs_frontend/tests/coprs_test_case.py index 5efa6f5..240e117 100644 --- a/frontend/coprs_frontend/tests/coprs_test_case.py +++ b/frontend/coprs_frontend/tests/coprs_test_case.py @@ -175,14 +175,19 @@ class CoprsTestCase(object): @pytest.fixture def f_builds(self): + self.p1 = models.Package( + copr=self.c1, name="hello-world", source_type=0) + self.p2 = models.Package( + copr=self.c2, name="hello-world", source_type=0) + self.b1 = models.Build( - copr=self.c1, user=self.u1, submitted_on=50) + copr=self.c1, package=self.p1, user=self.u1, submitted_on=50) self.b2 = models.Build( - copr=self.c1, user=self.u2, submitted_on=10) + copr=self.c1, package=self.p1, user=self.u2, submitted_on=10) self.b3 = models.Build( - copr=self.c2, user=self.u2, submitted_on=10) + copr=self.c2, package=self.p2, user=self.u2, submitted_on=10) self.b4 = models.Build( - copr=self.c2, user=self.u2, submitted_on=100) + copr=self.c2, package=self.p2, user=self.u2, submitted_on=100) self.b1_bc = [] self.b2_bc = [] diff --git a/frontend/coprs_frontend/tests/test_logic/test_builds_logic.py b/frontend/coprs_frontend/tests/test_logic/test_builds_logic.py index 828ed72..6676186 100644 --- a/frontend/coprs_frontend/tests/test_logic/test_builds_logic.py +++ b/frontend/coprs_frontend/tests/test_logic/test_builds_logic.py @@ -74,12 +74,12 @@ class TestBuildsLogic(CoprsTestCase): def test_build_queue_1(self, f_users, f_coprs, f_mock_chroots, f_builds, f_db): self.db.session.commit() - data = BuildsLogic.get_build_uploading_queue().all() + data = BuildsLogic.get_build_importing_queue().all() assert len(data) == 5 def test_build_queue_2(self, f_users, f_coprs, f_mock_chroots, f_db): self.db.session.commit() - data = BuildsLogic.get_build_uploading_queue().all() + data = BuildsLogic.get_build_importing_queue().all() assert len(data) == 0 def test_build_queue_3(self, f_users, f_coprs, f_mock_chroots, f_builds, f_db):