1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-04 00:20:07 +00:00

Rewrite 2fa, do not import models in package level

This commit is contained in:
zhengxie
2018-02-06 16:28:54 +08:00
parent 24b4e4a805
commit 2d56fd73c0
18 changed files with 117 additions and 125 deletions

View File

@@ -3,6 +3,7 @@ import pytest
from django.core.urlresolvers import reverse
from seahub.test_utils import BaseTestCase
from seahub.two_factor.models import TOTPDevice, devices_for_user
TRAVIS = 'TRAVIS' in os.environ
@@ -13,12 +14,9 @@ class TwoFactorAuthViewTest(BaseTestCase):
self.login_as(self.admin)
def test_can_disable_two_factor_auth(self):
from seahub.two_factor.models import (StaticDevice, TOTPDevice,
PhoneDevice)
totp = TOTPDevice(user=self.admin, name="", confirmed=1)
totp.save()
from seahub.two_factor import devices_for_user
devices = devices_for_user(self.admin)
i = 0
for device in devices_for_user(self.admin):