diff --git a/tests/__init__.py b/tests/__init__.py index e45f43c..f43b640 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -202,6 +202,14 @@ class Modeltests(unittest.TestCase): db_name = DB_PATH.rsplit('/', 1)[1] requests.get('%s/clean/%s' % (FAITOUT_URL, db_name)) + def get_csrf(self, url='/new'): + """Retrieve a CSRF token from given URL.""" + output = self.app.get(url) + self.assertEqual(output.status_code, 200) + + return output.data.split( + 'name="csrf_token" type="hidden" value="')[1].split('">')[0] + class FakeGroup(object): # pylint: disable=too-few-public-methods """ Fake object used to make the FakeUser object closer to the diff --git a/tests/test_pagure_flask_ui_quick_reply.py b/tests/test_pagure_flask_ui_quick_reply.py index 3df52b4..8dec2be 100644 --- a/tests/test_pagure_flask_ui_quick_reply.py +++ b/tests/test_pagure_flask_ui_quick_reply.py @@ -80,14 +80,6 @@ class PagureFlaskQuickReplytest(tests.Modeltests): self.repo.quick_replies = [self.r1, self.r2] self.session.add(self.repo) - def get_csrf(self, url='/test/settings'): - """Retrieve a CSRF token from given URL.""" - output = self.app.get(url) - self.assertEqual(output.status_code, 200) - - return output.data.split( - 'name="csrf_token" type="hidden" value="')[1].split('">')[0] - def assertRedirectToSettings(self, output, project='test', notice=None): """ Check that user was redirected to settings page of a given project