diff --git a/tests/test_pagure_flask_api_ui_private_repo.py b/tests/test_pagure_flask_api_ui_private_repo.py index 86c2f68..99f6506 100644 --- a/tests/test_pagure_flask_api_ui_private_repo.py +++ b/tests/test_pagure_flask_api_ui_private_repo.py @@ -436,28 +436,37 @@ class PagurePrivateRepotest(tests.Modeltests): output = self.app.get('/user/foo?repopage=abc&forkpage=def') self.assertEqual(output.status_code, 200) + output_text = output.get_data(as_text=True) self.assertIn( - """ - - Projects  - -
- - 0 - -
""", - output.get_data(as_text=True)) + """ + + Projects  + +
+ + 0 + +
""", output_text) self.assertIn( - """ - - Forks  - -
- - 0 - -
""", - output.get_data(as_text=True)) + """ + + Forks  + +
+ + 0 + +
""", output_text) + self.assertIn( + """ + + Groups  + +
+ + 0 + +
""", output_text) # Add a private project item = pagure.lib.model.Project( @@ -486,28 +495,37 @@ class PagurePrivateRepotest(tests.Modeltests): output = self.app.get('/user/foo') self.assertEqual(output.status_code, 200) + output_text = output.get_data(as_text=True) self.assertIn( - """ - - Projects  - -
- - 1 - -
""", - output.get_data(as_text=True)) + """ + + Projects  + +
+ + 1 + +
""", output_text) self.assertIn( - """ - - Forks  - -
- - 0 - -
""", - output.get_data(as_text=True)) + """ + + Forks  + +
+ + 0 + +
""", output_text) + self.assertIn( + """ + + Groups  + +
+ + 0 + +
""", output_text) user = tests.FakeUser(username='foo') with tests.user_set(self.app.application, user): @@ -515,36 +533,34 @@ class PagurePrivateRepotest(tests.Modeltests): output_text = output.get_data(as_text=True) self.assertIn( """ - - Projects  - -
- - 1 - -
""", - output_text) + + Projects  + +
+ + 1 + +
""", output_text) self.assertIn( """ - - Forks  - -
- - 0 - -
""", - output_text) + + Forks  + +
+ + 0 + +
""", output_text) self.assertIn( """ - - Groups  - -
- - 0 - -
""", output_text) + + Groups  + +
+ + 0 + +
""", output_text) user.username = 'pingou' with tests.user_set(self.app.application, user): @@ -552,36 +568,34 @@ class PagurePrivateRepotest(tests.Modeltests): output_text = output.get_data(as_text=True) self.assertIn( """ - - Projects  - -
- - 1 - -
""", - output_text) + + Projects  + +
+ + 1 + +
""", output_text) self.assertIn( """ - - Forks  - -
- - 0 - -
""", - output_text) + + Forks  + +
+ + 0 + +
""", output_text) self.assertIn( """ - - Groups  - -
- - 0 - -
""", output_text) + + Groups  + +
+ + 0 + +
""", output_text) # Check pingou has 0 projects user.username = 'pingou' @@ -835,41 +849,38 @@ class PagurePrivateRepotest(tests.Modeltests): self.assertEqual(output.status_code, 200) self.assertIn( """ - - Projects  - -
- - 0 - -
""", - output.get_data(as_text=True)) + + Projects  + +
+ + 0 + +
""", output.get_data(as_text=True)) self.assertIn( """ - - Forks  - -
- - 0 - -
""", - output.get_data(as_text=True)) + + Forks  + +
+ + 0 + +
""", output.get_data(as_text=True)) # Shows on the front page output = self.app.get('/dashboard/projects') self.assertEqual(output.status_code, 200) self.assertIn( """ - - Projects  - -
- - 1 - -
""", - output.get_data(as_text=True)) + + Projects  + +
+ + 1 + +
""", output.get_data(as_text=True)) self.set_up_git_repo(new_project=None, branch_from='feature') project = pagure.lib._get_project(self.session, 'pmc') diff --git a/tests/test_pagure_flask_ui_app.py b/tests/test_pagure_flask_ui_app.py index 1745da9..481c2f4 100644 --- a/tests/test_pagure_flask_ui_app.py +++ b/tests/test_pagure_flask_ui_app.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ - (c) 2015-2017 - Copyright Red Hat Inc + (c) 2015-2018 - Copyright Red Hat Inc Authors: Pierre-Yves Chibon @@ -84,26 +84,24 @@ class PagureFlaskApptests(tests.Modeltests): output_text = output.get_data(as_text=True) self.assertIn( """ - - Projects  - -
- - 3 - -
""", - output_text) + + Projects  + +
+ + 3 + +
""", output_text) self.assertIn( - """ - - Forks  - -
- - 0 - -
""", - output_text) + """ + + Forks  + +
+ + 0 + +
""", output_text) def test_view_user(self): """ Test the view_user endpoint. """ @@ -113,26 +111,24 @@ class PagureFlaskApptests(tests.Modeltests): output_text = output.get_data(as_text=True) self.assertIn( """ - - Projects  - -
- - 0 - -
""", - output_text) + + Projects  + +
+ + 0 + +
""", output_text) self.assertIn( - """ - - Forks  - -
- - 0 - -
""", - output_text) + """ + + Forks  + +
+ + 0 + +
""", output_text) tests.create_projects(self.session) self.gitrepos = tests.create_projects_git( @@ -143,26 +139,24 @@ class PagureFlaskApptests(tests.Modeltests): output_text = output.get_data(as_text=True) self.assertIn( """ - - Projects  - -
- - 3 - -
""", - output_text) + + Projects  + +
+ + 3 + +
""", output_text) self.assertIn( - """ - - Forks  - -
- - 0 - -
""", - output_text) + """ + + Forks  + +
+ + 0 + +
""", output_text) self.assertNotIn( 'page 1 of 2', output_text) diff --git a/tests/test_pagure_flask_ui_repo.py b/tests/test_pagure_flask_ui_repo.py index 5ed28cc..94c217d 100644 --- a/tests/test_pagure_flask_ui_repo.py +++ b/tests/test_pagure_flask_ui_repo.py @@ -3355,12 +3355,15 @@ index 0000000..fb7093d '6 projects', output_text) self.assertIn( -' Forks \n' -' \n' -'
\n' -' \n' -' 1', - output_text) + """ + + Forks  + +
+ + 1 + +
""", output_text) output = self.app.post( '/fork/pingou/test3/delete', follow_redirects=True) @@ -3464,24 +3467,24 @@ index 0000000..fb7093d output_text = output.get_data(as_text=True) self.assertIn( """ - - Projects  - -
- - 2 - -
""", output_text) + + Projects  +
+
+ + 2 + +
""", output_text) self.assertIn( """ - - Forks  - -
- - 0 - -
""", output_text) + + Forks  + +
+ + 0 + +
""", output_text) # Only git repo item = pagure.lib.model.Project( @@ -3500,24 +3503,24 @@ index 0000000..fb7093d output_text = output.get_data(as_text=True) self.assertIn( """ - - Projects  - -
- - 2 - -
""", output_text) + + Projects  + +
+ + 2 + +
""", output_text) self.assertIn( """ - - Forks  - -
- - 0 - -
""", output_text) + + Forks  + +
+ + 0 + +
""", output_text) # Only git and doc repo item = pagure.lib.model.Project( @@ -3536,24 +3539,24 @@ index 0000000..fb7093d output_text = output.get_data(as_text=True) self.assertIn( """ - - Projects  - -
- - 2 - -
""", output_text) + + Projects  + +
+ + 2 + +
""", output_text) self.assertIn( """ - - Forks  - -
- - 0 - -
""", output_text) + + Forks  + +
+ + 0 + +
""", output_text) # All repo there item = pagure.lib.model.Project( @@ -3580,24 +3583,17 @@ index 0000000..fb7093d output_text = output.get_data(as_text=True) self.assertIn( """ - - Projects  - -
- - 3 - -
""", output_text) + + Projects  + +
+ + 3 + +
""", output_text) self.assertNotIn( - """ - - Forks  - -
- - 0 - -
""", output_text) + """Forks """, + output_text) # add issues repo = pagure.lib.get_authorized_project(self.session, 'test') @@ -3687,48 +3683,41 @@ index 0000000..fb7093d output_text = output.get_data(as_text=True) self.assertIn( """ - - Projects  - -
- - 3 - -
""", output_text) + + Projects  + +
+ + 3 + +
""", output_text) self.assertNotIn( - """ - - Forks  - -
- - 0 - -
""", output_text) + """Forks """, + output_text) output = self.app.post('/test/delete', follow_redirects=True) self.assertEqual(output.status_code, 200) output_text = output.get_data(as_text=True) self.assertIn( """ - - Projects  - -
- - 2 - -
""", output_text) + + Projects  + +
+ + 2 + +
""", output_text) self.assertIn( """ - - Forks  - -
- - 0 - -
""", output_text) + + Forks  + +
+ + 0 + +
""", output_text) repo = pagure.lib.get_authorized_project(self.session, 'test') self.assertEqual(repo, None) @@ -3761,24 +3750,24 @@ index 0000000..fb7093d output_text = output.get_data(as_text=True) self.assertIn( """ - - Projects  - -
- - 2 - -
""", output_text) + + Projects  + +
+ + 2 + +
""", output_text) self.assertIn( """ - - Forks  - -
- - 1 - -
""", output_text) + + Forks  + +
+ + 1 + +
""", output_text) output = self.app.post( '/fork/pingou/test3/delete', follow_redirects=True) @@ -3786,24 +3775,24 @@ index 0000000..fb7093d output_text = output.get_data(as_text=True) self.assertIn( """ - - Projects  - -
- - 2 - -
""", output_text) + + Projects  + +
+ + 2 + +
""", output_text) self.assertIn( """ - - Forks  - -
- - 0 - -
""", output_text) + + Forks  + +
+ + 0 + +
""", output_text) @patch.dict('pagure.config.config', {'TICKETS_FOLDER': None}) @patch('pagure.lib.notify.send_email', MagicMock(return_value=True)) @@ -3829,24 +3818,17 @@ index 0000000..fb7093d output_text = output.get_data(as_text=True) self.assertIn( """ - - Projects  - -
- - 3 - -
""", output_text) + + Projects  + +
+ + 3 + +
""", output_text) self.assertNotIn( - """ - - Forks  - -
- - 0 - -
""", output_text) + """Forks """, + output_text) # Delete the project output = self.app.post('/test/delete', follow_redirects=True) @@ -3856,24 +3838,24 @@ index 0000000..fb7093d # Check deletion worked self.assertIn( """ - - Projects  - -
- - 2 - -
""", output_text) + + Projects  + +
+ + 2 + +
""", output_text) self.assertIn( """ - - Forks  - -
- - 0 - -
""", output_text) + + Forks  + +
+ + 0 + +
""", output_text) @patch('pagure.lib.notify.send_email') @patch('pagure.decorators.admin_session_timedout') @@ -3955,24 +3937,24 @@ index 0000000..fb7093d output_text = output.get_data(as_text=True) self.assertIn( """ - - Projects  - -
- - 0 - -
""", output_text) + + Projects  + +
+ + 0 + +
""", output_text) self.assertIn( """ - - Forks  - -
- - 0 - -
""", output_text) + + Forks  + +
+ + 0 + +
""", output_text) # Check after repo = pagure.lib.get_authorized_project(self.session, 'test') @@ -4076,24 +4058,24 @@ index 0000000..fb7093d output_text = output.get_data(as_text=True) self.assertIn( """ - - Projects  - -
- - 0 - -
""", output_text) + + Projects  + +
+ + 0 + +
""", output_text) self.assertIn( """ - - Forks  - -
- - 0 - -
""", output_text) + + Forks  + +
+ + 0 + +
""", output_text) # Check after repo = pagure.lib.get_authorized_project(self.session, 'test') @@ -4186,24 +4168,24 @@ index 0000000..fb7093d output_text = output.get_data(as_text=True) self.assertIn( """ - - Projects  - -
- - 0 - -
""", output_text) + + Projects  + +
+ + 0 + +
""", output_text) self.assertIn( """ - - Forks  - -
- - 0 - -
""", output_text) + + Forks  + +
+ + 0 + +
""", output_text) # Check after repo = pagure.lib.get_authorized_project(self.session, 'test')