From 99b438025f00237066c9d15320cdc6ef6cc5956f Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Dec 24 2015 09:22:02 +0000 Subject: Adjust unit-tests for the ui/fork.py controller --- diff --git a/tests/test_progit_flask_ui_fork.py b/tests/test_progit_flask_ui_fork.py index df4a438..f995e5c 100644 --- a/tests/test_progit_flask_ui_fork.py +++ b/tests/test_progit_flask_ui_fork.py @@ -231,8 +231,8 @@ class PagureFlaskForktests(tests.Modeltests): output = self.app.get('/test/pull-request/1') self.assertEqual(output.status_code, 200) self.assertIn( - 'PR#1: PR from the feature branch - test - ' - 'Pagure', output.data) + '

PR#1 ' + 'PR from the feature branch

', output.data) self.assertIn( 'title="View file as of 2a552b">View', output.data) @@ -256,9 +256,12 @@ class PagureFlaskForktests(tests.Modeltests): '/test/pull-request/1/merge', data={}, follow_redirects=True) self.assertEqual(output.status_code, 200) self.assertIn( - 'PR#1: PR from the feature branch - test - ' + '<title>PR#1: PR from the feature branch - test\n - ' 'Pagure', output.data) self.assertIn( + '

PR#1 ' + 'PR from the feature branch

', output.data) + self.assertIn( 'title="View file as of 2a552b">View', output.data) # Wrong project @@ -312,9 +315,12 @@ class PagureFlaskForktests(tests.Modeltests): '/test/pull-request/1/merge', data=data, follow_redirects=True) self.assertEqual(output.status_code, 200) self.assertIn( - 'PR#1: PR from the feature branch - test - ' + '<title>PR#1: PR from the feature branch - test\n - ' 'Pagure', output.data) self.assertIn( + '

PR#1 ' + 'PR from the feature branchThis request must be assigned to be merged', output.data) @@ -329,8 +335,8 @@ class PagureFlaskForktests(tests.Modeltests): '/test/pull-request/1/merge', data=data, follow_redirects=True) self.assertEqual(output.status_code, 200) self.assertIn( - 'PR#1: PR from the feature branch - test - ' - 'Pagure', output.data) + '

PR#1 ' + 'PR from the feature branchOnly the assignee can merge this review', output.data) @@ -346,8 +352,8 @@ class PagureFlaskForktests(tests.Modeltests): '/test/pull-request/1/merge', data=data, follow_redirects=True) self.assertEqual(output.status_code, 200) self.assertIn( - 'PR#1: PR from the feature branch - test - ' - 'Pagure', output.data) + '

PR#1 ' + 'PR from the feature branchThis request does not have the minimum ' 'review score necessary to be merged', output.data) @@ -427,8 +433,8 @@ class PagureFlaskForktests(tests.Modeltests): '/test/pull-request/1/merge', data=data, follow_redirects=True) self.assertEqual(output.status_code, 200) self.assertIn( - 'PR#1: PR from the feature branch - test - ' - 'Pagure', output.data) + '

PR#1 ' + 'PR from the feature branchMerge conflicts!', output.data) @@ -461,8 +467,8 @@ class PagureFlaskForktests(tests.Modeltests): '/test/pull-request/1/merge', data=data, follow_redirects=True) self.assertEqual(output.status_code, 200) self.assertIn( - 'PR#1: PR from the master branch - test - ' - 'Pagure', output.data) + '

PR#1 ' + 'PR from the master branch

', output.data) self.assertIn( '
  • Nothing to do, changes were already ' 'merged
  • ', output.data) @@ -477,8 +483,8 @@ class PagureFlaskForktests(tests.Modeltests): output = self.app.get('/test/pull-request/1') self.assertEqual(output.status_code, 200) self.assertIn( - 'PR#1: PR from the feature branch - test - ' - 'Pagure', output.data) + '

    PR#1 ' + 'PR from the feature branch

    ', output.data) self.assertIn( 'Merged by', output.data) self.assertIn( @@ -581,8 +587,8 @@ class PagureFlaskForktests(tests.Modeltests): output = self.app.get('/test/pull-request/1') self.assertEqual(output.status_code, 200) self.assertIn( - 'PR#1: PR from the feature branch - test - ' - 'Pagure', output.data) + '

    PR#1 ' + 'PR from the feature branch

    ', output.data) self.assertTrue(output.data.count(''), 1) shutil.rmtree(newpath) @@ -1085,11 +1091,11 @@ index 0000000..2a552bb '/test/pull-request/1/assign', follow_redirects=True) self.assertEqual(output.status_code, 200) self.assertIn( - 'PR#1: PR from the feature branch - test - ' + '<title>PR#1: PR from the feature branch - test\n - ' 'Pagure', output.data) self.assertIn( - '

    Pull Request: PR from the feature branch

    ', - output.data) + '

    PR#1 ' + 'PR from the feature branch

    ', output.data) self.assertNotIn( '
  • Request assigned
  • ', output.data) @@ -1109,11 +1115,11 @@ index 0000000..2a552bb follow_redirects=True) self.assertEqual(output.status_code, 200) self.assertIn( - 'PR#1: PR from the feature branch - test - ' + '<title>PR#1: PR from the feature branch - test\n - ' 'Pagure', output.data) self.assertIn( - '

    Pull Request: PR from the feature branch

    ', - output.data) + '

    PR#1 ' + 'PR from the feature branch

    ', output.data) self.assertNotIn( '
  • Request assigned
  • ', output.data) @@ -1128,11 +1134,11 @@ index 0000000..2a552bb follow_redirects=True) self.assertEqual(output.status_code, 200) self.assertIn( - 'PR#1: PR from the feature branch - test - ' + '<title>PR#1: PR from the feature branch - test\n - ' 'Pagure', output.data) self.assertIn( - '

    Pull Request: PR from the feature branch

    ', - output.data) + '

    PR#1 ' + 'PR from the feature branch

    ', output.data) self.assertIn( '
  • No user "bar" found
  • ', output.data) @@ -1148,11 +1154,11 @@ index 0000000..2a552bb follow_redirects=True) self.assertEqual(output.status_code, 200) self.assertIn( - 'PR#1: PR from the feature branch - test - ' + '<title>PR#1: PR from the feature branch - test\n - ' 'Pagure', output.data) self.assertIn( - '

    Pull Request: PR from the feature branch

    ', - output.data) + '

    PR#1 ' + 'PR from the feature branch

    ', output.data) self.assertIn( '
  • Request assigned
  • ', output.data) @@ -1200,7 +1206,7 @@ index 0000000..2a552bb output = self.app.get('/new/') self.assertEqual(output.status_code, 200) - self.assertTrue('

    New project

    ' in output.data) + self.assertIn('Create new Project', output.data) csrf_token = output.data.split( 'name="csrf_token" type="hidden" value="')[1].split('">')[0] @@ -1286,8 +1292,8 @@ index 0000000..2a552bb output = self.app.get('/test/diff/master..feature') self.assertEqual(output.status_code, 200) self.assertIn( - 'Diff from feature to master - test - Pagure', - output.data) + ' Create new Pull Request for master - test - ' + 'Pagure', output.data) self.assertIn( '', output.data) @@ -1304,7 +1310,7 @@ index 0000000..2a552bb '/test/diff/master..feature', data=data, follow_redirects=True) self.assertEqual(output.status_code, 200) self.assertIn( - 'PR#2: foo bar PR - test - Pagure', + 'PR#2: foo bar PR - test\n - Pagure', output.data) self.assertIn( '
  • Request created
  • ', output.data) @@ -1432,7 +1438,7 @@ index 0000000..2a552bb follow_redirects=True) self.assertEqual(output.status_code, 200) self.assertIn( - 'PR#1: PR from the feature branch - test - ' + '<title>PR#1: PR from the feature branch - test\n - ' 'Pagure', output.data) self.assertIn( '
  • Comment added
  • ', output.data) @@ -1477,9 +1483,9 @@ index 0000000..2a552bb '/test/pull-request/1/comment/drop', follow_redirects=True) self.assertEqual(output.status_code, 200) self.assertIn( - 'PR#1: PR from the feature branch - test - ' - 'Pagure', output.data) - self.assertIn('href="#comment-1">¶
    ', output.data) + '

    PR#1 ' + 'PR from the feature branch

    ', output.data) + #self.assertIn('href="#comment-1">¶', output.data) self.assertIn( '

    This look alright but we can do better

    ', output.data) @@ -1511,8 +1517,8 @@ index 0000000..2a552bb follow_redirects=True) self.assertEqual(output.status_code, 200) self.assertIn( - 'PR#1: PR from the feature branch - test - ' - 'Pagure', output.data) + '

    PR#1 ' + 'PR from the feature branchComment removed', output.data) @@ -1566,8 +1572,8 @@ index 0000000..2a552bb self.assertEqual(output.status_code, 200) self.assertIn( - 'PR#1: PR from the feature branch - test - ' - 'Pagure', output.data) + '

    PR#1 ' + 'PR from the feature branchComment added', output.data) # Check if the comment is there @@ -1595,11 +1601,12 @@ index 0000000..2a552bb self.assertIn( '

    This look alright but we can do better than this.

    ', output.data) self.assertIn( - 'PR#1: PR from the feature branch - test - ' - 'Pagure', output.data) + '

    PR#1 ' + 'PR from the feature branch\n Edited by pingou just now\n ', output.data) + 'Edited just now by pingou ', + output.data) self.assertIn( '
  • Comment updated
  • ', output.data)