Show More
@@ -1,5 +1,7 b'' | |||
|
1 | 1 | import pytest |
|
2 | import mock | |
|
2 | 3 | |
|
4 | from rhodecode.lib.type_utils import AttributeDict | |
|
3 | 5 | from rhodecode.model.meta import Session |
|
4 | 6 | from rhodecode.tests.fixture import Fixture |
|
5 | 7 | from rhodecode.tests.routes import route_path |
@@ -14,10 +16,6 b' class Test2FA(object):' | |||
|
14 | 16 | def setup_class(cls): |
|
15 | 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 | 19 | def test_redirect_to_2fa_setup_if_enabled_for_user(self, user_util): |
|
22 | 20 | user = user_util.create_user(password=self.password) |
|
23 | 21 | user.has_enabled_2fa = True |
@@ -63,5 +61,7 b' class Test2FA(object):' | |||
|
63 | 61 | def test_2fa_state_when_forced_by_admin(self, user_util): |
|
64 | 62 | user = user_util.create_user(password=self.password) |
|
65 | 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 | 67 | assert user.has_enabled_2fa |
General Comments 0
You need to be logged in to leave comments.
Login now