Skip to content
Snippets Groups Projects
Commit ee7be10b authored by Rajmund Hruška's avatar Rajmund Hruška
Browse files

Fix: Fix skipped and broken unit tests. (Redmine issue: #7494)

parent 879ec082
No related branches found
No related tags found
No related merge requests found
......@@ -21,10 +21,7 @@ import unittest
from hawat.test import HawatTestCase
from hawat.test.runner import TestRunnerMixin
_IS_NOSE = sys.argv[0].endswith('nosetests')
@unittest.skipIf(_IS_NOSE, "broken under nosetest")
class AuthTestCase(TestRunnerMixin, HawatTestCase):
"""
Class for testing :py:mod:`hawat.blueprints.auth` blueprint.
......
......@@ -24,10 +24,7 @@ import hawat.db
from hawat.test import HawatTestCase
from hawat.test.runner import TestRunnerMixin
_IS_NOSE = sys.argv[0].endswith('nosetests')
@unittest.skipIf(_IS_NOSE, "broken under nosetest")
class AuthAPITestCase(TestRunnerMixin, HawatTestCase):
"""
Class for testing :py:mod:`hawat.blueprints.auth_api` blueprint.
......@@ -122,7 +119,6 @@ class AuthAPITestCase(TestRunnerMixin, HawatTestCase):
)
self.assertEqual(response.status_code, 200)
self.assertTrue(b'Welcome!' in response.data)
self.assertTrue(b'My account' in response.data)
self.assertTrue(b'data-user-name="admin"' in response.data)
for tcase in (
......@@ -136,7 +132,6 @@ class AuthAPITestCase(TestRunnerMixin, HawatTestCase):
)
self.assertEqual(response.status_code, 200)
self.assertTrue(b'Welcome!' in response.data)
self.assertTrue(b'My account' in response.data)
self.assertTrue(b'data-user-name="admin"' in response.data)
@hawat.test.do_as_user_decorator(hawat.const.ROLE_USER)
......
......@@ -27,7 +27,6 @@ class AuthEnvTestCase(TestRunnerMixin, RegistrationHawatTestCase):
Class for testing :py:mod:`hawat.blueprints.auth_env` blueprint.
"""
@unittest.skip("temporarily disabled")
def test_01_login_user(self):
"""
Test login/logout with *auth_env* module - user 'user'.
......@@ -48,7 +47,6 @@ class AuthEnvTestCase(TestRunnerMixin, RegistrationHawatTestCase):
self.assertEqual(response.status_code, 200)
self.assertTrue(b'You have been successfully logged out' in response.data)
@unittest.skip("temporarily disabled")
def test_02_login_developer(self):
"""
Test login/logout with *auth_env* module - user 'developer'.
......@@ -69,7 +67,6 @@ class AuthEnvTestCase(TestRunnerMixin, RegistrationHawatTestCase):
self.assertEqual(response.status_code, 200)
self.assertTrue(b'You have been successfully logged out' in response.data)
@unittest.skip("temporarily disabled")
def test_03_login_admin(self):
"""
Test login/logout with *auth_env* module - user 'admin'.
......@@ -90,7 +87,6 @@ class AuthEnvTestCase(TestRunnerMixin, RegistrationHawatTestCase):
self.assertEqual(response.status_code, 200)
self.assertTrue(b'You have been successfully logged out' in response.data)
@unittest.skip("temporarily disabled")
def test_04_register(self):
"""
Test registration with *auth_env* module - new user 'test'.
......@@ -170,7 +166,6 @@ class AuthEnvTestCase(TestRunnerMixin, RegistrationHawatTestCase):
}
)
@unittest.skip("temporarily disabled")
def test_05_register_fail(self):
"""
Test registration with *auth_env* module - existing user 'user'.
......
......@@ -25,10 +25,6 @@ from hawat.test import HawatTestCase
from hawat.test.runner import TestRunnerMixin
_IS_NOSE = sys.argv[0].endswith('nosetests')
@unittest.skipIf(_IS_NOSE, "broken under nosetests")
class ChangeLogsSearchTestCase(TestRunnerMixin, HawatTestCase):
"""Class for testing ``changelogs.search`` endpoint."""
......
......@@ -20,9 +20,6 @@ from hawat.test import HawatTestCase
from hawat.test.runner import TestRunnerMixin
_IS_NOSE = sys.argv[0].endswith('nosetests')
@unittest.skipIf(_IS_NOSE, "broken under nosetest")
class ConfigTestCase(TestRunnerMixin, HawatTestCase):
"""
Class for testing ``devtools.config`` endpoint.
......@@ -30,6 +27,17 @@ class ConfigTestCase(TestRunnerMixin, HawatTestCase):
This endpoint is for developers only.
"""
def _attempt_fail_redirect(self):
self.assertGetURL(
'/devtools/config',
302,
[
b'Redirecting...',
b'login?next='
],
follow_redirects=False
)
def _attempt_fail(self):
self.assertGetURL(
'/devtools/config',
......@@ -51,7 +59,7 @@ class ConfigTestCase(TestRunnerMixin, HawatTestCase):
def test_01_as_anonymous(self):
"""Test access as anonymous user."""
self._attempt_fail()
self._attempt_fail_redirect()
@hawat.test.do_as_user_decorator(hawat.const.ROLE_USER)
def test_02_as_user(self):
......
......@@ -49,7 +49,7 @@ class AbstractSearchView(PsycopgMixin, BaseSearchView): # pylint: disable=local
"""
authentication = True
authorization = [hawat.acl.PERMISSION_DEVELOPER]
authorization = [hawat.acl.PERMISSION_POWER]
@classmethod
def get_menu_title(cls, **kwargs):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment