Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7cef5bd6
authored
Aug 10, 2016
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: fix tests
parent
8c311f33
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
2 deletions
+22
-2
circle/dashboard/tests/test_views.py
+22
-2
No files found.
circle/dashboard/tests/test_views.py
View file @
7cef5bd6
...
@@ -1869,7 +1869,7 @@ class TwoFactorTest(LoginMixin, TestCase):
...
@@ -1869,7 +1869,7 @@ class TwoFactorTest(LoginMixin, TestCase):
def
test_successful_2fa_login
(
self
):
def
test_successful_2fa_login
(
self
):
c
=
Client
()
c
=
Client
()
response
=
self
.
login
(
c
,
'user1'
)
self
.
login
(
c
,
'user1'
)
code
=
pyotp
.
TOTP
(
self
.
p1
.
two_factor_secret
)
.
now
()
code
=
pyotp
.
TOTP
(
self
.
p1
.
two_factor_secret
)
.
now
()
r
=
c
.
post
(
"/two-factor-login/"
,
{
'confirmation_code'
:
code
},
r
=
c
.
post
(
"/two-factor-login/"
,
{
'confirmation_code'
:
code
},
...
@@ -1879,8 +1879,28 @@ class TwoFactorTest(LoginMixin, TestCase):
...
@@ -1879,8 +1879,28 @@ class TwoFactorTest(LoginMixin, TestCase):
def
test_unsuccessful_2fa_login
(
self
):
def
test_unsuccessful_2fa_login
(
self
):
c
=
Client
()
c
=
Client
()
response
=
self
.
login
(
c
,
'user1'
)
self
.
login
(
c
,
'user1'
)
r
=
c
.
post
(
"/two-factor-login/"
,
{
'confirmation_code'
:
"nudli"
})
r
=
c
.
post
(
"/two-factor-login/"
,
{
'confirmation_code'
:
"nudli"
})
self
.
assertTemplateUsed
(
r
,
"registration/two-factor-login.html"
)
self
.
assertTemplateUsed
(
r
,
"registration/two-factor-login.html"
)
self
.
assertContains
(
r
,
"Welcome Bela Akkounter (user1)!"
)
self
.
assertContains
(
r
,
"Welcome Bela Akkounter (user1)!"
)
def
test_straight_to_2fa_as_anonymous
(
self
):
c
=
Client
()
response
=
c
.
get
(
"/two-factor-login/"
,
follow
=
True
)
self
.
assertItemsEqual
(
response
.
redirect_chain
,
[(
'http://testserver/'
,
302
),
(
'http://testserver/dashboard/'
,
302
),
(
'http://testserver/accounts/login/?next=/dashboard/'
,
302
)]
)
def
test_straight_to_2fa_as_user
(
self
):
c
=
Client
()
self
.
login
(
c
,
'user2'
)
response
=
c
.
get
(
"/two-factor-login/"
,
follow
=
True
)
self
.
assertItemsEqual
(
response
.
redirect_chain
,
[(
'http://testserver/'
,
302
),
(
'http://testserver/dashboard/'
,
302
)]
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment