[copr] bkabrda-workspace: Test adding new copr (a23368b)
bkabrda at fedorahosted.org
bkabrda at fedorahosted.org
Wed Nov 21 07:57:13 UTC 2012
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : bkabrda-workspace
>---------------------------------------------------------------
commit a23368b8f3e3a2858441d6dc024c5d06403926b4
Author: Bohuslav Kabrda <bkabrda at redhat.com>
Date: Wed Nov 21 08:56:58 2012 +0100
Test adding new copr
>---------------------------------------------------------------
.../tests/test_views/test_coprs_ns/test_general.py | 34 ++++++++++++++++++++
1 files changed, 34 insertions(+), 0 deletions(-)
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 c350c07..c42b097 100644
--- a/wsgi/tests/test_views/test_coprs_ns/test_general.py
+++ b/wsgi/tests/test_views/test_coprs_ns/test_general.py
@@ -51,3 +51,37 @@ class TestCoprsAllowed(CoprsTestCase):
r = c.get('/coprs/allowed/{0}/'.format(self.u2.name))
assert r.data.count('<div class=copr>') == 1
+
+class TestCoprNew(CoprsTestCase):
+ def test_copr_new_normal(self, f_users):
+ with self.tc as c:
+ with c.session_transaction() as s:
+ s['openid'] = self.u1.openid_name
+
+ r = c.post('/coprs/new/', data = {'name': 'foo', 'release': 'fedora-rawhide', 'arches': ['i386']}, follow_redirects = True)
+ assert self.models.Copr.query.filter(self.models.Copr.name == 'foo').first()
+ assert "New entry was successfully posted" in r.data
+
+ def test_copr_new_exists_for_another_user(self, f_users, f_coprs):
+ with self.tc as c:
+ with c.session_transaction() as s:
+ s['openid'] = self.u3.openid_name
+
+ foocoprs = len(self.models.Copr.query.filter(self.models.Copr.name == 'foocopr').all())
+ assert foocoprs > 0
+
+ r = c.post('/coprs/new/', data = {'name': 'foocopr', 'release': 'fedora-rawhide', 'arches': ['i386']}, follow_redirects = True)
+ assert len(self.models.Copr.query.filter(self.models.Copr.name == 'foocopr').all()) == foocoprs + 1
+ assert "New entry was successfully posted" in r.data
+
+ def test_copr_new_exists_for_this_user(self, f_users, f_coprs):
+ with self.tc as c:
+ with c.session_transaction() as s:
+ s['openid'] = self.u1.openid_name
+
+ foocoprs = len(self.models.Copr.query.filter(self.models.Copr.name == 'foocopr').all())
+ assert foocoprs > 0
+
+ r = c.post('/coprs/new/', data = {'name': 'foocopr', 'release': 'fedora-rawhide', 'arches': ['i386']}, follow_redirects = True)
+ assert len(self.models.Copr.query.filter(self.models.Copr.name == 'foocopr').all()) == foocoprs
+ assert "You already have copr named" in r.data
More information about the copr-devel
mailing list