Repository :
http://git.fedorahosted.org/cgit/copr.git
On branch : bkabrda-workspace
---------------------------------------------------------------
commit 3122b10f886a0229e3bcdb8d3cfd93e69894d5cf
Author: Bohuslav Kabrda <bkabrda(a)redhat.com>
Date: Fri Nov 23 12:15:29 2012 +0100
Some initial builds tests and removal of unnecessary fixtures
---------------------------------------------------------------
wsgi/tests/coprs_test_case.py | 3 --
wsgi/tests/test_views/test_coprs_ns/test_builds.py | 21 ++++++++++++++++++++
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/wsgi/tests/coprs_test_case.py b/wsgi/tests/coprs_test_case.py
index a70d721..297b6c8 100644
--- a/wsgi/tests/coprs_test_case.py
+++ b/wsgi/tests/coprs_test_case.py
@@ -51,9 +51,6 @@ class CoprsTestCase(object):
self.b3 = models.Build(copr = self.c2, user = self.u2, chroots = self.c2.chroots,
submitted_on = 10)
self.b4 = models.Build(copr = self.c2, user = self.u2, chroots = self.c2.chroots,
submitted_on = 100)
- 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.db.session.add_all([self.b1, self.b2, self.b3, self.b4])
self.db.session.commit()
diff --git a/wsgi/tests/test_views/test_coprs_ns/test_builds.py
b/wsgi/tests/test_views/test_coprs_ns/test_builds.py
new file mode 100644
index 0000000..857fb61
--- /dev/null
+++ b/wsgi/tests/test_views/test_coprs_ns/test_builds.py
@@ -0,0 +1,21 @@
+import flask
+
+from tests.coprs_test_case import CoprsTestCase
+
+class TestCoprShowBuilds(CoprsTestCase):
+ def test_copr_show_builds(self, f_users, f_coprs, f_builds):
+ r = self.tc.get('/coprs/detail/{0}/{1}/builds/'.format(self.u2.name,
self.c2.name))
+ print r.data
+ assert r.data.count('<tr class=build-') == 2
+
+class TestCoprAddBuild(CoprsTestCase):
+ def test_copr_owner_can_add_build(self, f_users, f_coprs):
+ with self.tc as c:
+ with c.session_transaction() as s:
+ s['openid'] = self.u1.openid_name
+
+ self.db.session.add_all([self.u1, self.c1])
+ r = c.post('/coprs/detail/{0}/{1}/add_build/'.format(self.u1.name,
self.c1.name),
+ data = {'pkgs': 'http://foo.bar'},
+ follow_redirects = True)
+ assert len(self.models.Build.query.all()) == 1