fix(2fa): fixed tests to use mock instead of global value which causes some other tests to fail
This commit is contained in:
parent
45e456bdf0
commit
85ed19f363
1 changed files with 6 additions and 6 deletions
|
|
@ -1,5 +1,7 @@
|
|||
import pytest
|
||||
import mock
|
||||
|
||||
from rhodecode.lib.type_utils import AttributeDict
|
||||
from rhodecode.model.meta import Session
|
||||
from rhodecode.tests.fixture import Fixture
|
||||
from rhodecode.tests.routes import route_path
|
||||
|
|
@ -14,10 +16,6 @@ class Test2FA(object):
|
|||
def setup_class(cls):
|
||||
cls.password = 'valid-one'
|
||||
|
||||
@classmethod
|
||||
def teardown_class(cls):
|
||||
SettingsModel().create_or_update_setting('auth_rhodecode_global_2fa', False)
|
||||
|
||||
def test_redirect_to_2fa_setup_if_enabled_for_user(self, user_util):
|
||||
user = user_util.create_user(password=self.password)
|
||||
user.has_enabled_2fa = True
|
||||
|
|
@ -63,5 +61,7 @@ class Test2FA(object):
|
|||
def test_2fa_state_when_forced_by_admin(self, user_util):
|
||||
user = user_util.create_user(password=self.password)
|
||||
user.has_enabled_2fa = False
|
||||
SettingsModel().create_or_update_setting('auth_rhodecode_global_2fa', True)
|
||||
assert user.has_enabled_2fa
|
||||
with mock.patch.object(
|
||||
SettingsModel, 'get_setting_by_name', lambda *a, **kw: AttributeDict(app_settings_value=True)):
|
||||
|
||||
assert user.has_enabled_2fa
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue