Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-ora2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-ora2
Commits
a00be4c3
Commit
a00be4c3
authored
Jun 02, 2017
by
Eric Fischer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix broken auto_auth page
parent
6db440fc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
12 deletions
+7
-12
test/acceptance/auto_auth.py
+7
-12
No files found.
test/acceptance/auto_auth.py
View file @
a00be4c3
"""
Auto-auth page (used to automatically log in during testing).
"""
import
json
import
os
import
re
import
urllib
...
...
@@ -54,6 +54,8 @@ class AutoAuthPage(PageObject):
if
roles
is
not
None
:
self
.
_params
[
'roles'
]
=
roles
self
.
data
=
{}
@property
def
url
(
self
):
"""
...
...
@@ -68,24 +70,17 @@ class AutoAuthPage(PageObject):
return
url
def
is_browser_on_page
(
self
):
message
=
self
.
q
(
css
=
'BODY'
)
.
text
[
0
]
match
=
re
.
search
(
r'Logged in user ([^$]+) with password ([^$]+) and user_id ([^$]+)$'
,
message
)
return
True
if
match
else
False
self
.
data
=
json
.
loads
(
self
.
q
(
css
=
'BODY'
)
.
text
[
0
])
return
self
.
data
[
'created_status'
]
==
"Logged in"
def
get_user_id
(
self
):
"""
Finds and returns the user_id
"""
message
=
self
.
q
(
css
=
'BODY'
)
.
text
[
0
]
.
strip
()
match
=
re
.
search
(
r' user_id ([^$]+)$'
,
message
)
return
match
.
groups
()[
0
]
if
match
else
None
return
self
.
data
[
'user_id'
]
def
get_username_and_email
(
self
):
"""
Finds and returns the username and email address of the current user.
"""
message
=
self
.
q
(
css
=
'BODY'
)
.
text
[
0
]
.
strip
()
match
=
re
.
search
(
r'Logged in user (\S+) \((.*)\).*'
,
message
)
if
not
match
:
return
None
return
match
.
group
(
1
),
match
.
group
(
2
)
return
self
.
data
[
'username'
],
self
.
data
[
'email'
]
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