Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
commit b7d7f8526ecb10f7fd1dc0f9812a4e8bfa58ff1a Author: Valentin Gologuzov vgologuz@redhat.com Date: Wed Nov 19 14:16:56 2014 +0100
[frontend] bugfix: RHBZ: #1165284 - monitor pages throws 500 on deleted project
.../coprs/views/coprs_ns/coprs_general.py | 2 +- .../test_views/test_coprs_ns/test_coprs_general.py | 31 ++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletions(-)
diff --git a/frontend/coprs_frontend/coprs/views/coprs_ns/coprs_general.py b/frontend/coprs_frontend/coprs/views/coprs_ns/coprs_general.py index 9284f2b..85ddc3d 100644 --- a/frontend/coprs_frontend/coprs/views/coprs_ns/coprs_general.py +++ b/frontend/coprs_frontend/coprs/views/coprs_ns/coprs_general.py @@ -556,7 +556,7 @@ def generate_repo_file(username, coprname, chroot, repofile): def copr_build_monitor(username, coprname): try: copr = coprs_logic.CoprsLogic.get( - flask.g.user, username, coprname).first() + flask.g.user, username, coprname, with_mock_chroots=True).one() except sqlalchemy.orm.exc.NoResultFound: return page_not_found( "Copr with name {0} does not exist.".format(coprname)) diff --git a/frontend/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_general.py b/frontend/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_general.py index c4f4be5..311036a 100644 --- a/frontend/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_general.py +++ b/frontend/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_general.py @@ -8,9 +8,40 @@ import time from coprs import models from coprs.signals import copr_created
+from coprs.logic.coprs_logic import CoprsLogic + from tests.coprs_test_case import CoprsTestCase, TransactionDecorator
+class TestMonitor(CoprsTestCase): + + def test_regression_monitor_no_copr_returned(self, f_db, f_users, f_mock_chroots): + # https://bugzilla.redhat.com/show_bug.cgi?id=1165284 + + copr_name = u"temp" + + # trying to get monitor page for non-existing project + res = self.tc.get("/coprs/{}/{}/monitor/".format(self.u1.name, copr_name)) + assert res.status_code == 404 + + tmp_copr = models.Copr(name=copr_name, owner=self.u1) + cc = models.CoprChroot() + cc.mock_chroot = self.mc1 + tmp_copr.copr_chroots.append(cc) + + self.db.session.add_all([tmp_copr, cc]) + self.db.session.commit() + + res = self.tc.get("/coprs/{}/{}/monitor/".format(self.u1.name, copr_name)) + assert res.status_code == 200 + + self.db.session.add(CoprsLogic.delete(self.u1, tmp_copr)) + self.db.session.commit() + + res = self.tc.get("/coprs/{}/{}/monitor/".format(self.u1.name, copr_name)) + assert res.status_code == 404 + + class TestCoprsShow(CoprsTestCase):
def test_show_no_entries(self):
copr-commits@lists.fedorahosted.org