Show More
@@ -1,5 +1,7 b'' | |||||
1 | import pytest |
|
1 | import pytest | |
|
2 | import mock | |||
2 |
|
3 | |||
|
4 | from rhodecode.lib.type_utils import AttributeDict | |||
3 | from rhodecode.model.meta import Session |
|
5 | from rhodecode.model.meta import Session | |
4 | from rhodecode.tests.fixture import Fixture |
|
6 | from rhodecode.tests.fixture import Fixture | |
5 | from rhodecode.tests.routes import route_path |
|
7 | from rhodecode.tests.routes import route_path | |
@@ -14,10 +16,6 b' class Test2FA(object):' | |||||
14 | def setup_class(cls): |
|
16 | def setup_class(cls): | |
15 | cls.password = 'valid-one' |
|
17 | cls.password = 'valid-one' | |
16 |
|
18 | |||
17 | @classmethod |
|
|||
18 | def teardown_class(cls): |
|
|||
19 | SettingsModel().create_or_update_setting('auth_rhodecode_global_2fa', False) |
|
|||
20 |
|
||||
21 | def test_redirect_to_2fa_setup_if_enabled_for_user(self, user_util): |
|
19 | def test_redirect_to_2fa_setup_if_enabled_for_user(self, user_util): | |
22 | user = user_util.create_user(password=self.password) |
|
20 | user = user_util.create_user(password=self.password) | |
23 | user.has_enabled_2fa = True |
|
21 | user.has_enabled_2fa = True | |
@@ -63,5 +61,7 b' class Test2FA(object):' | |||||
63 | def test_2fa_state_when_forced_by_admin(self, user_util): |
|
61 | def test_2fa_state_when_forced_by_admin(self, user_util): | |
64 | user = user_util.create_user(password=self.password) |
|
62 | user = user_util.create_user(password=self.password) | |
65 | user.has_enabled_2fa = False |
|
63 | user.has_enabled_2fa = False | |
66 | SettingsModel().create_or_update_setting('auth_rhodecode_global_2fa', True) |
|
64 | with mock.patch.object( | |
|
65 | SettingsModel, 'get_setting_by_name', lambda *a, **kw: AttributeDict(app_settings_value=True)): | |||
|
66 | ||||
67 | assert user.has_enabled_2fa |
|
67 | assert user.has_enabled_2fa |
General Comments 0
You need to be logged in to leave comments.
Login now