[copr] bkabrda-workspace: Improve the fixtures (ddb1ded)

bkabrda at fedorahosted.org bkabrda at fedorahosted.org
Tue Nov 20 13:42:47 UTC 2012


Repository : http://git.fedorahosted.org/cgit/copr.git

On branch  : bkabrda-workspace

>---------------------------------------------------------------

commit ddb1ded849fec7c976ab8b4316060da0266b4a16
Author: Bohuslav Kabrda <bkabrda at redhat.com>
Date:   Tue Nov 20 14:42:09 2012 +0100

    Improve the fixtures


>---------------------------------------------------------------

 wsgi/tests/coprs_test_case.py |   39 +++++++++++++++++++++++++++++++++++----
 1 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/wsgi/tests/coprs_test_case.py b/wsgi/tests/coprs_test_case.py
index 2f8f304..9b60e63 100644
--- a/wsgi/tests/coprs_test_case.py
+++ b/wsgi/tests/coprs_test_case.py
@@ -26,9 +26,40 @@ class CoprsTestCase(object):
             self.db.engine.execute(tbl.delete())
 
     @pytest.fixture
-    def f_data1(self):
-        u = models.User(openid_name = 'user1', proven = False)
-        c = models.Copr(name = 'foocopr', chroots = 'fedora-18-x86_64', owner = u)
+    def f_users(self):
+        self.u1 = models.User(openid_name = 'http://user1.id.fedoraproject.org/', proven = False)
+        self.u2 = models.User(openid_name = 'http://user2.id.fedoraproject.org/', proven = False)
+        self.u3 = models.User(openid_name = 'http://user3.id.fedoraproject.org/', proven = False)
 
-        self.db.session.add_all([u, c])
+        self.db.session.add_all([self.u1, self.u2, self.u3])
+        self.db.session.commit()
+
+    @pytest.fixture
+    def f_coprs(self):
+        self.c1 = models.Copr(name = 'foocopr', chroots = 'fedora-18-x86_64', owner = self.u1)
+        self.c2 = models.Copr(name = 'foocopr', chroots = 'fedora-17-x86_64 fedora-17-i386', owner = self.u2)
+        self.c3 = models.Copr(name = 'barcopr', chroots = 'fedora-rawhide-i386', owner = self.u2)
+
+        self.db.session.add_all([self.c1, self.c2, self.c3])
+        self.db.session.commit()
+
+    @pytest.fixture
+    def f_builds(self):
+        self.b1 = models.Build(copr = self.c1, user = self.u1, chroots = self.c1.chroots, submitted_on = 50)
+        self.b2 = models.Build(copr = self.c1, user = self.u2, chroots = 'fedora-17-x86_64', submitted_on = 10)
+        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()
+
+    @pytest.fixture
+    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.db.session.add_all([self.cp1, self.cp2])
         self.db.session.commit()



More information about the copr-devel mailing list