[copr] bkabrda-workspace: More test cases (04e9f59)
bkabrda at fedorahosted.org
bkabrda at fedorahosted.org
Tue Nov 20 14:16:10 UTC 2012
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : bkabrda-workspace
>---------------------------------------------------------------
commit 04e9f59af1652dab6d6c4c7153d4abb0d945e1f8
Author: Bohuslav Kabrda <bkabrda at redhat.com>
Date: Tue Nov 20 15:16:02 2012 +0100
More test cases
>---------------------------------------------------------------
wsgi/tests/coprs_test_case.py | 1 +
.../tests/test_views/test_coprs_ns/test_general.py | 26 ++++++++++++++++++++
2 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/wsgi/tests/coprs_test_case.py b/wsgi/tests/coprs_test_case.py
index 9b60e63..45b5572 100644
--- a/wsgi/tests/coprs_test_case.py
+++ b/wsgi/tests/coprs_test_case.py
@@ -60,6 +60,7 @@ class CoprsTestCase(object):
def f_copr_permissions(self):
self.cp1 = models.CoprPermission(copr = self.c2, user = self.u2, approved = True)
self.cp2 = models.CoprPermission(copr = self.c3, user = self.u2, approved = False)
+ self.cp3 = models.CoprPermission(copr = self.c3, user = self.u1, approved = True)
self.db.session.add_all([self.cp1, self.cp2])
self.db.session.commit()
diff --git a/wsgi/tests/test_views/test_coprs_ns/test_general.py b/wsgi/tests/test_views/test_coprs_ns/test_general.py
index 2174cb7..c350c07 100644
--- a/wsgi/tests/test_views/test_coprs_ns/test_general.py
+++ b/wsgi/tests/test_views/test_coprs_ns/test_general.py
@@ -10,6 +10,7 @@ class TestCoprsShow(CoprsTestCase):
r = self.tc.get('/')
assert r.data.count('<div class=copr>') == 3
+class TestCoprsOwned(CoprsTestCase):
def test_owned_none(self, f_users, f_coprs):
with self.tc as c:
with c.session_transaction() as s:
@@ -25,3 +26,28 @@ class TestCoprsShow(CoprsTestCase):
r = c.get('/coprs/owned/{0}/'.format(self.u1.name))
assert r.data.count('<div class=copr>') == 1
+
+class TestCoprsAllowed(CoprsTestCase):
+ def test_allowed_none(self, f_users, f_coprs, f_copr_permissions):
+ with self.tc as c:
+ with c.session_transaction() as s:
+ s['openid'] = self.u3.openid_name
+
+ r = c.get('/coprs/allowed/{0}/'.format(self.u3.name))
+ assert r.data.find('No entries') != -1
+
+ def test_allowed_one(self, f_users, f_coprs, f_copr_permissions):
+ with self.tc as c:
+ with c.session_transaction() as s:
+ s['openid'] = self.u1.openid_name
+
+ r = c.get('/coprs/allowed/{0}/'.format(self.u1.name))
+ assert r.data.count('<div class=copr>') == 1
+
+ def test_allowed_one_but_asked_for_one_more(self, f_users, f_coprs, f_copr_permissions):
+ with self.tc as c:
+ with c.session_transaction() as s:
+ s['openid'] = self.u2.openid_name
+
+ r = c.get('/coprs/allowed/{0}/'.format(self.u2.name))
+ assert r.data.count('<div class=copr>') == 1
More information about the copr-devel
mailing list