changeset 6264:93a56b5264d3

tests: fix pull request tests - review_members is not a string but a list of integers (as strings) Also sneaking in a bit of response status cleanup ...
author Mads Kiilerich <madski@unity3d.com>
date Mon, 24 Oct 2016 15:18:51 +0200
parents 358f9a456a43
children ec2e9123c683
files kallithea/tests/functional/test_pullrequests.py
diffstat 1 files changed, 9 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/tests/functional/test_pullrequests.py	Mon Oct 24 15:18:51 2016 +0200
+++ b/kallithea/tests/functional/test_pullrequests.py	Mon Oct 24 15:18:51 2016 +0200
@@ -2,6 +2,7 @@
 
 from kallithea.tests.base import *
 from kallithea.tests.fixture import Fixture
+from kallithea.model.db import User
 from kallithea.model.meta import Session
 
 from kallithea.controllers.pullrequests import PullrequestsController
@@ -26,9 +27,8 @@
                                   'pullrequest_title': 'title',
                                   'pullrequest_desc': 'description',
                                   '_authentication_token': self.authentication_token(),
-                                 }
-                                )
-        assert response.status == '302 Found'
+                                 },
+                                 status=302)
         response = response.follow()
         assert response.status == '200 OK'
         response.mustcontain('This pull request has already been merged to default.')
@@ -47,9 +47,8 @@
                                   'pullrequest_title': 'title',
                                   'pullrequest_desc': 'description',
                                   '_authentication_token': self.authentication_token(),
-                                 }
-                                )
-        assert response.status == '302 Found'
+                                 },
+                                status=302)
         # location is of the form:
         # http://localhost/vcs_test_hg/pull-request/54/_/title
         m = re.search('/pull-request/(\d+)/', response.location)
@@ -65,7 +64,7 @@
                                   'pullrequest_desc': 'description',
                                   'owner': TEST_USER_ADMIN_LOGIN,
                                   '_authentication_token': self.authentication_token(),
-                                  'review_members': invalid_user_id,
+                                  'review_members': [str(invalid_user_id)],
                                  },
                                  status=400)
         response.mustcontain('Invalid reviewer &#34;%s&#34; specified' % invalid_user_id)
@@ -84,9 +83,8 @@
                                   'pullrequest_title': 'title',
                                   'pullrequest_desc': 'description',
                                   '_authentication_token': self.authentication_token(),
-                                 }
-                                )
-        assert response.status == '302 Found'
+                                 },
+                                status=302)
         # location is of the form:
         # http://localhost/vcs_test_hg/pull-request/54/_/title
         m = re.search('/pull-request/(\d+)/', response.location)
@@ -101,7 +99,7 @@
                                   'pullrequest_desc': 'description',
                                   'owner': TEST_USER_ADMIN_LOGIN,
                                   '_authentication_token': self.authentication_token(),
-                                  'review_members': invalid_user_id,
+                                  'review_members': [str(invalid_user_id)],
                                  },
                                  status=400)
         response.mustcontain('Invalid reviewer &#34;%s&#34; specified' % invalid_user_id)