Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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-platform
Commits
47d316d1
Commit
47d316d1
authored
Apr 24, 2014
by
Christine Lytwynec
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add AutoAuthPage to lms pages for bok-choy tests
parent
bf56d303
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
83 additions
and
4 deletions
+83
-4
common/test/acceptance/pages/lms/__init__.py
+3
-0
common/test/acceptance/pages/lms/auto_auth.py
+76
-0
common/test/acceptance/tests/test_discussion.py
+1
-1
common/test/acceptance/tests/test_lms.py
+1
-1
common/test/acceptance/tests/test_ora.py
+1
-1
common/test/acceptance/tests/test_video_module.py
+1
-1
No files found.
common/test/acceptance/pages/lms/__init__.py
View file @
47d316d1
...
...
@@ -2,3 +2,6 @@ import os
# Get the URL of the instance under test
BASE_URL
=
os
.
environ
.
get
(
'test_url'
,
'http://localhost:8003'
)
# The URL used for user auth in testing
AUTH_BASE_URL
=
os
.
environ
.
get
(
'test_url'
,
'http://localhost:8031'
)
common/test/acceptance/pages/lms/auto_auth.py
0 → 100644
View file @
47d316d1
"""
Auto-auth page (used to automatically log in during testing).
"""
import
re
import
urllib
from
bok_choy.page_object
import
PageObject
from
.
import
AUTH_BASE_URL
class
AutoAuthPage
(
PageObject
):
"""
The automatic authorization page.
When allowed via the django settings file, visiting
this url will create a user and log them in.
"""
def
__init__
(
self
,
browser
,
username
=
None
,
email
=
None
,
password
=
None
,
staff
=
None
,
course_id
=
None
,
roles
=
None
):
"""
Auto-auth is an end-point for HTTP GET requests.
By default, it will create accounts with random user credentials,
but you can also specify credentials using querystring parameters.
`username`, `email`, and `password` are the user's credentials (strings)
`staff` is a boolean indicating whether the user is global staff.
`course_id` is the ID of the course to enroll the student in.
Currently, this has the form "org/number/run"
Note that "global staff" is NOT the same as course staff.
"""
super
(
AutoAuthPage
,
self
)
.
__init__
(
browser
)
# Create query string parameters if provided
self
.
_params
=
{}
if
username
is
not
None
:
self
.
_params
[
'username'
]
=
username
if
email
is
not
None
:
self
.
_params
[
'email'
]
=
email
if
password
is
not
None
:
self
.
_params
[
'password'
]
=
password
if
staff
is
not
None
:
self
.
_params
[
'staff'
]
=
"true"
if
staff
else
"false"
if
course_id
is
not
None
:
self
.
_params
[
'course_id'
]
=
course_id
if
roles
is
not
None
:
self
.
_params
[
'roles'
]
=
roles
@property
def
url
(
self
):
"""
Construct the URL.
"""
url
=
AUTH_BASE_URL
+
"/auto_auth"
query_str
=
urllib
.
urlencode
(
self
.
_params
)
if
query_str
:
url
+=
"?"
+
query_str
return
url
def
is_browser_on_page
(
self
):
return
True
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
common/test/acceptance/tests/test_discussion.py
View file @
47d316d1
...
...
@@ -5,7 +5,7 @@ Tests for discussion pages
from
uuid
import
uuid4
from
.helpers
import
UniqueCourseTest
from
..pages.
studio
.auto_auth
import
AutoAuthPage
from
..pages.
lms
.auto_auth
import
AutoAuthPage
from
..pages.lms.courseware
import
CoursewarePage
from
..pages.lms.discussion
import
(
DiscussionTabSingleThreadPage
,
...
...
common/test/acceptance/tests/test_lms.py
View file @
47d316d1
...
...
@@ -6,7 +6,7 @@ E2E tests for the LMS.
from
unittest
import
skip
from
.helpers
import
UniqueCourseTest
,
load_data_str
from
..pages.
studio
.auto_auth
import
AutoAuthPage
from
..pages.
lms
.auto_auth
import
AutoAuthPage
from
..pages.lms.find_courses
import
FindCoursesPage
from
..pages.lms.course_about
import
CourseAboutPage
from
..pages.lms.course_info
import
CourseInfoPage
...
...
common/test/acceptance/tests/test_ora.py
View file @
47d316d1
...
...
@@ -7,7 +7,7 @@ from unittest import skip
from
bok_choy.promise
import
Promise
,
BrokenPromise
from
..pages.lms.peer_confirm
import
PeerConfirmPage
from
..pages.
studio
.auto_auth
import
AutoAuthPage
from
..pages.
lms
.auto_auth
import
AutoAuthPage
from
..pages.lms.course_info
import
CourseInfoPage
from
..pages.lms.tab_nav
import
TabNavPage
from
..pages.lms.course_nav
import
CourseNavPage
...
...
common/test/acceptance/tests/test_video_module.py
View file @
47d316d1
...
...
@@ -8,7 +8,7 @@ from .helpers import UniqueCourseTest
from
..pages.lms.video
import
VideoPage
from
..pages.lms.tab_nav
import
TabNavPage
from
..pages.lms.course_nav
import
CourseNavPage
from
..pages.
studio
.auto_auth
import
AutoAuthPage
from
..pages.
lms
.auto_auth
import
AutoAuthPage
from
..pages.lms.course_info
import
CourseInfoPage
from
..fixtures.course
import
CourseFixture
,
XBlockFixtureDesc
...
...
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