diff --git a/tests/test_progit_flask_ui_app.py b/tests/test_progit_flask_ui_app.py index cdaf071..3c2cf07 100644 --- a/tests/test_progit_flask_ui_app.py +++ b/tests/test_progit_flask_ui_app.py @@ -55,13 +55,17 @@ class PagureFlaskApptests(tests.Modeltests): output = self.app.get('/') self.assertEqual(output.status_code, 200) - self.assertTrue('

All Projects (0)

' in output.data) + self.assertIn( + '

All Projects 0All Projects (2)

' in output.data) + self.assertIn( + '

All Projects 2' in output.data) - self.assertTrue('

My Forks (0)

' in output.data) - self.assertTrue( - '
' in output.data) - self.assertTrue('

My Projects (0)

' in output.data) - self.assertTrue( - '
' in output.data) - self.assertTrue('

All Projects (3)

' in output.data) + self.assertIn( + 'My Projects 0', + output.data) + self.assertIn( + 'My Forks 0', + output.data) + self.assertEqual( + output.data.count('

No projects found

'), 2) + self.assertEqual( + output.data.count('
'), 2) def test_view_users(self): """ Test the view_users endpoint. """ output = self.app.get('/users/?page=abc') self.assertEqual(output.status_code, 200) - self.assertTrue('

2 users registered.

' in output.data) - self.assertTrue('' in output.data) - self.assertTrue('' in output.data) + self.assertIn( + '

Users 2', + output.data) + self.assertIn( + '', + output.data) def test_view_user(self): """ Test the view_user endpoint. """ @@ -101,11 +112,15 @@ class PagureFlaskApptests(tests.Modeltests): output = self.app.get('/user/pingou?repopage=abc&forkpage=def') self.assertEqual(output.status_code, 200) self.assertTrue( - '
' in output.data) - self.assertTrue('

Projects (0)

' in output.data) + '
' in output.data) + self.assertIn( + '

Projects 0' in output.data) - self.assertTrue('

Forks (0)

' in output.data) + '
' in output.data) + self.assertIn( + '

Forks 0' in output.data) - self.assertTrue('

Projects (2)

' in output.data) + '
' in output.data) + self.assertIn( + '

Projects 2' in output.data) - self.assertTrue('

Forks (0)

' in output.data) + '
' in output.data) + self.assertIn( + '

Forks 0New 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] @@ -149,23 +168,23 @@ class PagureFlaskApptests(tests.Modeltests): output = self.app.post('/new/', data=data) self.assertEqual(output.status_code, 200) - self.assertTrue('

New project

' in output.data) - self.assertTrue( - 'This field is required.' - in output.data) + self.assertIn('Create new Project', output.data) + self.assertIn( + '\n This field is required.' + ' \n ', output.data) data['name'] = 'project-1' output = self.app.post('/new/', data=data) self.assertEqual(output.status_code, 200) - self.assertTrue('

New project

' in output.data) - self.assertFalse( - 'This field is required.' - in output.data) + self.assertIn('Create new Project', output.data) + self.assertNotIn( + '\n This field is required.' + ' \n ', output.data) data['csrf_token'] = csrf_token output = self.app.post('/new/', data=data) self.assertEqual(output.status_code, 200) - self.assertTrue('

New project

' in output.data) + self.assertIn('Create new Project', output.data) self.assertTrue( '
  • No user "username" found
  • ' in output.data) @@ -235,10 +254,12 @@ class PagureFlaskApptests(tests.Modeltests): self.assertTrue( '
  • Public ssh key updated
  • ' in output.data) - self.assertTrue( - '
    ' in output.data) - self.assertTrue( - '
    ' in output.data) + self.assertIn( + 'Projects 1', + output.data) + self.assertIn( + 'Forks 0', + output.data) ast.return_value = True output = self.app.get('/settings/')