| |
@@ -423,6 +423,34 @@
|
| |
|
| |
@patch('pagure.lib.git.update_git')
|
| |
@patch('pagure.lib.notify.send_email')
|
| |
+ def test_view_issues_redirect(self, p_send_email, p_ugt):
|
| |
+ """ Test the view_issues endpoint. """
|
| |
+ p_send_email.return_value = True
|
| |
+ p_ugt.return_value = True
|
| |
+
|
| |
+ output = self.app.get('/foo/issue')
|
| |
+ self.assertEqual(output.status_code, 302)
|
| |
+
|
| |
+ output = self.app.get('/foo/issue', follow_redirects=True)
|
| |
+ self.assertEqual(output.status_code, 404)
|
| |
+
|
| |
+ tests.create_projects(self.session)
|
| |
+ tests.create_projects_git(
|
| |
+ os.path.join(self.path, 'repos'), bare=True)
|
| |
+
|
| |
+ output = self.app.get('/test/issue')
|
| |
+ self.assertEqual(output.status_code, 302)
|
| |
+
|
| |
+ output = self.app.get('/test/issue', follow_redirects=True)
|
| |
+ self.assertEqual(output.status_code, 200)
|
| |
+ self.assertIn(
|
| |
+ 'div class="projectinfo m-t-1 m-b-1">\ntest project #1 '
|
| |
+ '</div>', output.data)
|
| |
+ self.assertTrue(
|
| |
+ '<h2>\n 0 Open Issues' in output.data)
|
| |
+
|
| |
+ @patch('pagure.lib.git.update_git')
|
| |
+ @patch('pagure.lib.notify.send_email')
|
| |
def test_view_issues(self, p_send_email, p_ugt):
|
| |
""" Test the view_issues endpoint. """
|
| |
p_send_email.return_value = True
|
| |
I think it is better and nicer to override the setUp() method of the class instead of calling a test.
you have an example here https://pagure.io/pagure/blob/master/f/tests/test_pagure_lib.py#_152