diff --git a/tests/test_pagure_flask_internal.py b/tests/test_pagure_flask_internal.py index 9de087d..b13b250 100644 --- a/tests/test_pagure_flask_internal.py +++ b/tests/test_pagure_flask_internal.py @@ -1767,8 +1767,8 @@ class PagureFlaskInternaltests(tests.Modeltests): [u'code', u'message'] ) self.assertEqual(js_data['code'], 'OK') - self.assertEqual( - js_data['message'].keys(), + self.assertListEqual( + sorted(js_data['message'].keys()), [u'branch_w_pr', u'new_branch']) self.assertEqual(js_data['message']['branch_w_pr'], {}) self.assertEqual(js_data['message']['new_branch'].keys(), ['feature']) @@ -1893,7 +1893,7 @@ class PagureFlaskInternaltests(tests.Modeltests): ) self.assertEqual(js_data['code'], 'OK') self.assertEqual( - js_data['message'].keys(), + sorted(js_data['message'].keys()), [u'branch_w_pr', u'new_branch']) self.assertEqual(js_data['message']['branch_w_pr'], {}) self.assertEqual(js_data['message']['new_branch'].keys(), ['feature']) diff --git a/tests/test_pagure_flask_ui_fork.py b/tests/test_pagure_flask_ui_fork.py index e588e8b..40665b3 100644 --- a/tests/test_pagure_flask_ui_fork.py +++ b/tests/test_pagure_flask_ui_fork.py @@ -592,8 +592,11 @@ class PagureFlaskForktests(tests.Modeltests): self.assertEqual(output.status_code, 404) @patch('pagure.lib.notify.send_email') - def test_request_pull_empty_repo(self, send_email): + @patch('pagure.lib.git.update_pull_ref') + def test_request_pull_empty_repo(self, send_email, update_pull_ref): """ Test the request_pull endpoint against an empty repo. """ + # Mock update_pull_ref or the repo won't be empty anymore + # (the PR will have been pushed to refs/pull) send_email.return_value = True tests.create_projects(self.session) @@ -672,6 +675,7 @@ class PagureFlaskForktests(tests.Modeltests): ' PR from the feature branch\n', output.data) self.assertTrue( output.data.count('', output.data) - self.assertIn( - 'Could not set the session in the db, please report ' - 'this error to an admin', output.data) - else: - self.assertIn( - '', output.data) + # We have set the REMOTE_ADDR in the request, so this works with all + # versions of Flask. + self.assertIn( + '', output.data) @patch.dict('pagure.config.config', {'PAGURE_AUTH': 'local'}) @patch('pagure.lib.notify.send_email', MagicMock(return_value=True))