diff --git a/tests/test_progit_flask_ui_issues.py b/tests/test_progit_flask_ui_issues.py index e507195..9b722d8 100644 --- a/tests/test_progit_flask_ui_issues.py +++ b/tests/test_progit_flask_ui_issues.py @@ -117,7 +117,9 @@ class PagureFlaskIssuestests(tests.Modeltests): self.assertEqual(output.status_code, 200) self.assertTrue( '
' in output.data) - self.assertTrue('test project #1
' in output.data) + self.assertTrue( + 'test project #1
' + in output.data) self.assertTrue('test project #1
' in output.data) + self.assertTrue( + 'test project #1
' + in output.data) self.assertTrue('test project #1
' in output.data) + self.assertTrue( + 'test project #1
' + in output.data) self.assertTrue( 'test project #1
' in output.data) + self.assertTrue( + 'test project #1
' + in output.data) self.assertTrue( 'test project #1
' in output.data) + self.assertTrue( + 'test project #1
' + in output.data) self.assertTrue( 'Login to comment on this ticket.
' @@ -219,7 +229,9 @@ class PagureFlaskIssuestests(tests.Modeltests): with tests.user_set(pagure.APP, user): output = self.app.get('/test/issue/1') self.assertEqual(output.status_code, 200) - self.assertTrue('test project #1
' in output.data) + self.assertTrue( + 'test project #1
' + in output.data) self.assertFalse( 'Login to comment on this ticket.
' in output.data) @@ -228,7 +240,9 @@ class PagureFlaskIssuestests(tests.Modeltests): with tests.user_set(pagure.APP, user): output = self.app.get('/test/issue/1') self.assertEqual(output.status_code, 200) - self.assertTrue('test project #1
' in output.data) + self.assertTrue( + 'test project #1
' + in output.data) csrf_token = output.data.split( 'name="csrf_token" type="hidden" value="')[1].split('">')[0] @@ -262,7 +276,9 @@ class PagureFlaskIssuestests(tests.Modeltests): with tests.user_set(pagure.APP, user): output = self.app.get('/test/issue/2') self.assertEqual(output.status_code, 200) - self.assertTrue('test project #1
' in output.data) + self.assertTrue( + 'test project #1
' + in output.data) # Project w/o issue tracker repo = pagure.lib.get_project(self.session, 'test') @@ -306,7 +322,9 @@ class PagureFlaskIssuestests(tests.Modeltests): with tests.user_set(pagure.APP, user): output = self.app.get('/test/issue/1') self.assertEqual(output.status_code, 200) - self.assertTrue('test project #1
' in output.data) + self.assertTrue( + 'test project #1
' + in output.data) csrf_token = output.data.split( 'name="csrf_token" type="hidden" value="')[1].split('">')[0] @@ -318,7 +336,9 @@ class PagureFlaskIssuestests(tests.Modeltests): output = self.app.post( '/test/issue/1/update', data=data, follow_redirects=True) self.assertEqual(output.status_code, 200) - self.assertTrue('test project #1
' in output.data) + self.assertTrue( + 'test project #1
' + in output.data) self.assertFalse( '' in output.data) @@ -327,7 +347,9 @@ class PagureFlaskIssuestests(tests.Modeltests): output = self.app.post( '/test/issue/1/update', data=data, follow_redirects=True) self.assertEqual(output.status_code, 200) - self.assertTrue('test project #1
' in output.data) + self.assertTrue( + 'test project #1
' + in output.data) self.assertFalse( '' in output.data) @@ -336,7 +358,9 @@ class PagureFlaskIssuestests(tests.Modeltests): output = self.app.post( '/test/issue/1/update', data=data, follow_redirects=True) self.assertEqual(output.status_code, 200) - self.assertTrue('test project #1
' in output.data) + self.assertTrue( + 'test project #1
' + in output.data) self.assertTrue( ' ' in output.data) @@ -353,7 +377,9 @@ class PagureFlaskIssuestests(tests.Modeltests): output = self.app.post( '/test/issue/1/update', data=data, follow_redirects=True) self.assertEqual(output.status_code, 200) - self.assertTrue('test project #1
' in output.data) + self.assertTrue( + 'test project #1
' + in output.data) self.assertTrue( ' ' in output.data) self.assertFalse( @@ -375,9 +401,11 @@ class PagureFlaskIssuestests(tests.Modeltests): output = self.app.post( '/test/issue/1/update', data=data, follow_redirects=True) self.assertEqual(output.status_code, 200) - self.assertTrue('test project #1
' in output.data) self.assertTrue( - ' ' in output.data) + 'test project #1
' + in output.data) + self.assertTrue( + ' ' in output.data) self.assertFalse( 'li class="message">No changes to edit' in output.data) self.assertTrue( @@ -397,7 +425,9 @@ class PagureFlaskIssuestests(tests.Modeltests): output = self.app.post( '/test/issue/1/update', data=data, follow_redirects=True) self.assertEqual(output.status_code, 200) - self.assertTrue('test project #1
' in output.data) + self.assertTrue( + 'test project #1
' + in output.data) self.assertTrue( 'test project #1
' in output.data) + self.assertTrue( + 'test project #1
' + in output.data) self.assertTrue( ' ' in output.data) self.assertTrue( @@ -461,7 +493,9 @@ class PagureFlaskIssuestests(tests.Modeltests): output = self.app.post( '/test/issue/2/update', data=data, follow_redirects=True) self.assertEqual(output.status_code, 200) - self.assertTrue('test project #1
' in output.data) + self.assertTrue( + 'test project #1
' + in output.data) self.assertTrue( 'test project #1
' in output.data) + self.assertTrue( + 'test project #1
' + in output.data) self.assertTrue( ' ' in output.data) @@ -719,11 +755,11 @@ class PagureFlaskIssuestests(tests.Modeltests): msg = pagure.lib.add_issue_tag( session=self.session, issue=issue, - tag='tag1', + tags='tag1', user='pingou', ticketfolder=None) self.session.commit() - self.assertEqual(msg, 'Tag added') + self.assertEqual(msg, 'Tag added: tag1') # Before edit, list tags tags = pagure.lib.get_tags_of_project(self.session, repo) diff --git a/tests/test_progit_lib.py b/tests/test_progit_lib.py index 40f4a0c..7675dce 100644 --- a/tests/test_progit_lib.py +++ b/tests/test_progit_lib.py @@ -303,21 +303,21 @@ class PagureLibtests(tests.Modeltests): msg = pagure.lib.add_issue_tag( session=self.session, issue=issue, - tag='tag1', + tags='tag1', user='pingou', ticketfolder=None) self.session.commit() - self.assertEqual(msg, 'Tag added') + self.assertEqual(msg, 'Tag added: tag1') # Try a second time - self.assertRaises( - pagure.exceptions.PagureException, - pagure.lib.add_issue_tag, + msg = pagure.lib.add_issue_tag( session=self.session, issue=issue, - tag='tag1', + tags='tag1', user='pingou', ticketfolder=None) + self.session.commit() + self.assertEqual(msg, 'Nothing to add') issues = pagure.lib.search_issues(self.session, repo, tags='tag1') self.assertEqual(len(issues), 1) @@ -373,7 +373,7 @@ class PagureLibtests(tests.Modeltests): user='pingou', ticketfolder=None) - self.assertEqual(msgs, [u'Removed tag: tag1']) + self.assertEqual(msgs, 'Removed tag: tag1') @patch('pagure.lib.git.update_git') @patch('pagure.lib.notify.send_email') @@ -1414,12 +1414,12 @@ class PagureLibtests(tests.Modeltests): messages = pagure.lib.update_tags_issue( self.session, issue, 'tag', 'pingou', ticketfolder=None) - self.assertEqual(messages, ['Tag added']) + self.assertEqual(messages, ['Tag added: tag']) messages = pagure.lib.update_tags_issue( self.session, issue, ['tag2', 'tag3'], 'pingou', ticketfolder=None) self.assertEqual( - messages, ['Tag added', 'Tag added', 'Removed tag: tag']) + messages, ['Tag added: tag2, tag3', 'Removed tag: tag']) # after self.assertEqual(issue.tags_text, ['tag2', 'tag3']) diff --git a/tests/test_progit_lib_git.py b/tests/test_progit_lib_git.py index 18c18a7..a59b29a 100644 --- a/tests/test_progit_lib_git.py +++ b/tests/test_progit_lib_git.py @@ -305,7 +305,7 @@ index 0000000..60f7480 --- /dev/null +++ b/456 @@ -0,0 +1 @@ -+{"status": "Open", "blocks": "", "tags": "", "title": "Test issue", "private": false, "content": "We should work on this", "depends": "", "user": {"fullname": "PY C", "name": "pingou", "emails": ["bar@pingou.com", "foo@pingou.com"]}, "date_created": null, "id": 1, "comments": []} ++{"status": "Open", "blocks": "", "tags": [], "title": "Test issue", "private": false, "content": "We should work on this", "assignee": null, "depends": "", "user": {"fullname": "PY C", "name": "pingou", "emails": ["bar@pingou.com", "foo@pingou.com"]}, "date_created": null, "id": 1, "comments": []} \ No newline at end of file """ @@ -334,6 +334,7 @@ index 0000000..60f7480 row = '+++ b/456' npatch.append(row) patch = '\n'.join(npatch) + #print patch self.assertEqual(patch, exp) # Test again after adding a comment @@ -363,9 +364,9 @@ index 458821a..77674a8 --- a/123 +++ b/456 @@ -1 +1 @@ --{"status": "Open", "blocks": "", "tags": "", "title": "Test issue", "private": false, "content": "We should work on this", "depends": "", "user": {"fullname": "PY C", "name": "pingou", "emails": ["bar@pingou.com", "foo@pingou.com"]}, "date_created": null, "id": 1, "comments": []} +-{"status": "Open", "blocks": "", "tags": [], "title": "Test issue", "private": false, "content": "We should work on this", "assignee": null, "depends": "", "user": {"fullname": "PY C", "name": "pingou", "emails": ["bar@pingou.com", "foo@pingou.com"]}, "date_created": null, "id": 1, "comments": []} \ No newline at end of file -+{"status": "Open", "blocks": "", "tags": "", "title": "Test issue", "private": false, "content": "We should work on this", "depends": "", "user": {"fullname": "PY C", "name": "pingou", "emails": ["bar@pingou.com", "foo@pingou.com"]}, "date_created": null, "id": 1, "comments": [{"comment": "Hey look a comment!", "date_created": null, "id": 1, "parent": null, "user": {"fullname": "foo bar", "name": "foo", "emails": ["foo@bar.com"]}}]} ++{"status": "Open", "blocks": "", "tags": [], "title": "Test issue", "private": false, "content": "We should work on this", "assignee": null, "depends": "", "user": {"fullname": "PY C", "name": "pingou", "emails": ["bar@pingou.com", "foo@pingou.com"]}, "date_created": null, "id": 1, "comments": [{"comment": "Hey look a comment!", "date_created": null, "id": 1, "parent": null, "user": {"fullname": "foo bar", "name": "foo", "emails": ["foo@bar.com"]}}]} \ No newline at end of file """ @@ -401,6 +402,7 @@ index 458821a..77674a8 row = '+++ b/456' npatch.append(row) patch = '\n'.join(npatch) + #print patch self.assertEqual(patch, exp) def test_update_ticket_from_git(self):