diff --git a/tests/__init__.py b/tests/__init__.py
index e4a619f..0646b80 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -295,6 +295,8 @@ class SimplePagureTest(unittest.TestCase):
self.path, 'repos')
pagure_config['REQUESTS_FOLDER'] = os.path.join(
gf, 'requests')
+ pagure.config.config['TICKETS_FOLDER'] = os.path.join(
+ gf, 'tickets')
pagure_config['ATTACHMENTS_FOLDER'] = os.path.join(
self.path, 'attachments')
diff --git a/tests/test_pagure_flask_form.py b/tests/test_pagure_flask_form.py
index 05aded9..5778bd3 100644
--- a/tests/test_pagure_flask_form.py
+++ b/tests/test_pagure_flask_form.py
@@ -31,9 +31,8 @@ import tests
class PagureFlaskFormTests(tests.SimplePagureTest):
""" Tests for forms of the flask application """
+ @patch.dict('pagure.config.config', {'SERVER_NAME': 'pagure.org'})
def setUp(self):
- pagure.config.config['SERVER_NAME'] = 'pagure.org'
-
super(PagureFlaskFormTests, self).setUp()
def test_csrf_form_no_input(self):
diff --git a/tests/test_pagure_flask_ui_app.py b/tests/test_pagure_flask_ui_app.py
index cf52446..d825f3c 100644
--- a/tests/test_pagure_flask_ui_app.py
+++ b/tests/test_pagure_flask_ui_app.py
@@ -1693,6 +1693,7 @@ class PagureFlaskAppNoDocstests(tests.Modeltests):
def tearDown(self):
pagure.config.config['ENABLE_DOCS'] = True
+ super(PagureFlaskAppNoDocstests, self).tearDown()
@patch.dict('pagure.config.config', {'DOCS_FOLDER': None})
def test_new_project_no_docs_folder(self):
@@ -1746,12 +1747,16 @@ class PagureFlaskAppNoTicketstests(tests.Modeltests):
""" Tests for flask app controller of pagure """
def setUp(self):
+ # Stop the current running workers
+ tests.tearDown()
+
pagure.config.config['TICKETS_FOLDER'] = None
pagure.config.config['ENABLE_TICKETS'] = False
self.path = tempfile.mkdtemp(prefix='pagure-tests-path-')
+ tests.setUp()
- self._set_db_path()
+ self.dbpath = 'sqlite:///%s' % os.path.join(self.path, 'db.sqlite')
config_path = os.path.join(self.path, 'config')
config_values = {'path': self.path, 'dburl': self.dbpath}
@@ -1762,13 +1767,16 @@ class PagureFlaskAppNoTicketstests(tests.Modeltests):
f.write(config_content)
super(PagureFlaskAppNoTicketstests, self).setUp()
+ pagure.config.config['TICKETS_FOLDER'] = None
+ pagure.config.config['ENABLE_TICKETS'] = False
def tearDown(self):
pagure.config.config['ENABLE_TICKETS'] = True
+ super(PagureFlaskAppNoTicketstests, self).tearDown()
@patch.dict('pagure.config.config', {'TICKETS_FOLDER': None})
def test_new_project_no_tickets_folder(self):
- """ Test the new_project endpoint with DOCS_FOLDER is None. """
+ """ Test the new_project endpoint with TICKETS_FOLDER is None. """
# Before
projects = pagure.lib.search_projects(self.session)
self.assertEqual(len(projects), 0)
diff --git a/tests/test_pagure_flask_ui_issues.py b/tests/test_pagure_flask_ui_issues.py
index b0661ba..dd846e7 100644
--- a/tests/test_pagure_flask_ui_issues.py
+++ b/tests/test_pagure_flask_ui_issues.py
@@ -1143,10 +1143,10 @@ class PagureFlaskIssuestests(tests.Modeltests):
'',
output.data)
- self.assertTrue(
+ self.assertIn(
''
- 'Login\n to comment on this ticket.'
- in output.data)
+ 'Login\n to comment on this ticket.',
+ output.data)
user = tests.FakeUser()
with tests.user_set(self.app.application, user):
diff --git a/tests/test_pagure_flask_ui_plugins_fedmsg.py b/tests/test_pagure_flask_ui_plugins_fedmsg.py
index a69f6d4..ebb00d9 100644
--- a/tests/test_pagure_flask_ui_plugins_fedmsg.py
+++ b/tests/test_pagure_flask_ui_plugins_fedmsg.py
@@ -34,6 +34,11 @@ class PagureFlaskPluginFedmsgtests(tests.SimplePagureTest):
tests.create_projects_git(os.path.join(self.path, 'repos'))
tests.create_projects_git(os.path.join(self.path, 'docs'))
+ def tearDown(self):
+ """ Tear Down the environment after the tests. """
+ super(PagureFlaskPluginFedmsgtests, self).tearDown()
+ pagure.config.config['DOCS_FOLDER'] = None
+
def test_plugin_fedmsg_defaul_page(self):
""" Test the fedmsg plugin endpoint's default page. """
@@ -111,6 +116,8 @@ class PagureFlaskPluginFedmsgtests(tests.SimplePagureTest):
""" Test the setting up the fedmsg plugin when there are no Docs
folder.
"""
+ pagure.config.config['DOCS_FOLDER'] = os.path.join(
+ self.path, 'repos', 'docs')
user = tests.FakeUser(username='pingou')
with tests.user_set(self.app.application, user):
diff --git a/tests/test_pagure_flask_ui_plugins_pagure_hook.py b/tests/test_pagure_flask_ui_plugins_pagure_hook.py
index 738b5db..dc03854 100644
--- a/tests/test_pagure_flask_ui_plugins_pagure_hook.py
+++ b/tests/test_pagure_flask_ui_plugins_pagure_hook.py
@@ -34,6 +34,11 @@ class PagureFlaskPluginPagureHooktests(tests.SimplePagureTest):
tests.create_projects_git(os.path.join(self.path, 'repos'))
tests.create_projects_git(os.path.join(self.path, 'repos', 'docs'))
+ def tearDown(self):
+ """ Tear Down the environment after the tests. """
+ super(PagureFlaskPluginPagureHooktests, self).tearDown()
+ pagure.config.config['DOCS_FOLDER'] = None
+
def test_plugin_mail_page(self):
""" Test the default page of the pagure hook plugin. """
@@ -122,6 +127,8 @@ class PagureFlaskPluginPagureHooktests(tests.SimplePagureTest):
def test_plugin_mail_activate_hook(self):
""" Test the pagure hook plugin endpoint when activating the hook.
"""
+ pagure.config.config['DOCS_FOLDER'] = os.path.join(
+ self.path, 'repos', 'docs')
user = tests.FakeUser(username='pingou')
with tests.user_set(self.app.application, user):