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
8414ef02
Commit
8414ef02
authored
Aug 07, 2013
by
Jay Zoldak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify lms acceptance test to use auto_auth.
parent
e78edf8e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
25 deletions
+8
-25
common/djangoapps/terrain/course_helpers.py
+5
-25
lms/envs/acceptance.py
+3
-0
No files found.
common/djangoapps/terrain/course_helpers.py
View file @
8414ef02
...
...
@@ -34,33 +34,13 @@ def create_user(uname, password):
@world.absorb
def
log_in
(
username
,
password
):
def
log_in
(
username
=
'robot'
,
password
=
'test'
,
email
=
'robot@edx.org'
,
name
=
'Robot'
):
"""
Log the user in programatically.
This will delete any existing cookies to ensure that the user
logs in to the correct session.
Use the auto_auth feature to programmatically log the user in
"""
# Authenticate the user
world
.
scenario_dict
[
'USER'
]
=
authenticate
(
username
=
username
,
password
=
password
)
assert
(
world
.
scenario_dict
[
'USER'
]
is
not
None
and
world
.
scenario_dict
[
'USER'
]
.
is_active
)
# Send a fake HttpRequest to log the user in
# We need to process the request using
# Session middleware and Authentication middleware
# to ensure that session state can be stored
request
=
HttpRequest
()
SessionMiddleware
()
.
process_request
(
request
)
AuthenticationMiddleware
()
.
process_request
(
request
)
login
(
request
,
world
.
scenario_dict
[
'USER'
])
# Save the session
request
.
session
.
save
()
# Retrieve the sessionid and add it to the browser's cookies
cookie_dict
=
{
settings
.
SESSION_COOKIE_NAME
:
request
.
session
.
session_key
}
world
.
browser
.
cookies
.
delete
()
world
.
browser
.
cookies
.
add
(
cookie_dict
)
url
=
'/auto_auth?username=
%
s&password=
%
s&name=
%
s&email=
%
s'
%
(
username
,
password
,
name
,
email
)
world
.
visit
(
url
)
@world.absorb
...
...
lms/envs/acceptance.py
View file @
8414ef02
...
...
@@ -83,6 +83,9 @@ MITX_FEATURES['STUB_VIDEO_FOR_TESTING'] = True
# per-test control for acceptance tests
MITX_FEATURES
[
'ENABLE_DISCUSSION_SERVICE'
]
=
True
# Use the auto_auth workflow for creating users and logging them in
MITX_FEATURES
[
'AUTOMATIC_AUTH_FOR_TESTING'
]
=
True
# Include the lettuce app for acceptance testing, including the 'harvest' django-admin command
INSTALLED_APPS
+=
(
'lettuce.django'
,)
LETTUCE_APPS
=
(
'courseware'
,)
...
...
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