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
b4e6a8b2
Commit
b4e6a8b2
authored
Sep 23, 2013
by
Julian Arni
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix order-dependency in tests
parent
268b5b47
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
14 deletions
+38
-14
common/djangoapps/contentserver/tests/test.py
+21
-14
common/test/data/toy/static/another_static.txt
+17
-0
No files found.
common/djangoapps/contentserver/tests/test.py
View file @
b4e6a8b2
...
...
@@ -45,31 +45,42 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
settings
.
MODULESTORE
[
'default'
][
'OPTIONS'
][
'fs_root'
]
=
path
(
'common/test/data'
)
settings
.
MODULESTORE
[
'direct'
][
'OPTIONS'
][
'fs_root'
]
=
path
(
'common/test/data'
)
base
=
"http://127.0.0.1:8000"
self
.
client
=
Client
()
self
.
contentstore
=
contentstore
()
# A locked the asset
loc
=
Location
(
'c4x'
,
'edX'
,
'toy'
,
'asset'
,
'sample_static.txt'
)
self
.
loc
=
loc
self
.
loc
=
loc
rel_url
=
StaticContent
.
get_url_path_from_location
(
loc
)
base
=
"http://127.0.0.1:8000"
self
.
url
=
base
+
rel_url
# An unlocked asset
loc2
=
Location
(
'c4x'
,
'edX'
,
'toy'
,
'asset'
,
'another_static.txt'
)
self
.
loc2
=
loc2
rel_url2
=
StaticContent
.
get_url_path_from_location
(
loc2
)
self
.
url2
=
base
+
rel_url2
self
.
contentstore
=
contentstore
()
import_from_xml
(
modulestore
(
'direct'
),
'common/test/data/'
,
[
'toy'
],
static_content_store
=
self
.
contentstore
,
verbose
=
True
)
self
.
url
=
base
+
rel_url
self
.
contentstore
.
set_attr
(
self
.
loc
,
'locked'
,
True
)
def
tearDown
(
self
):
MongoClient
()
.
drop_database
(
TEST_DATA_CONTENTSTORE
[
'OPTIONS'
][
'db'
])
_CONTENTSTORE
.
clear
()
def
test_
a
unlocked_asset
(
self
):
def
test_unlocked_asset
(
self
):
"""
Test that unlocked assets are being served.
"""
# Unlock the asset
self
.
contentstore
.
set_attr
(
self
.
loc
,
'locked'
,
False
)
resp
=
self
.
client
.
get
(
self
.
url
)
# Logout user
self
.
client
.
logout
()
resp
=
self
.
client
.
get
(
self
.
url2
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
...
...
@@ -81,10 +92,6 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
(3) User is logged in and registered
"""
# Lock the asset
self
.
contentstore
.
set_attr
(
self
.
loc
,
'locked'
,
True
)
# Case (1)
resp
=
self
.
client
.
get
(
self
.
url
)
self
.
assertEqual
(
resp
.
status_code
,
302
)
...
...
@@ -110,7 +117,7 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
# Case (3)
# Enroll student
course_id
=
"/"
.
join
([
self
.
loc
.
org
,
self
.
loc
.
course
,
self
.
loc
.
name
])
self
.
assertTrue
(
CourseEnrollment
.
enroll
(
user
,
course_id
)
)
CourseEnrollment
.
enroll
(
user
,
course_id
)
self
.
assertTrue
(
CourseEnrollment
.
is_enrolled
(
user
,
course_id
))
resp
=
self
.
client
.
get
(
self
.
url
)
...
...
common/test/data/toy/static/another_static.txt
0 → 100644
View file @
b4e6a8b2
_
| |
_____ ____ _ _ __ ___ _ __ | | ___
/ _ \ \/ / _` | '_ ` _ \| '_ \| |/ _ \
| __/> < (_| | | | | | | |_) | | __/
\___/_/\_\__,_|_| |_| |_| .__/|_|\___|
| |
|_|
_ _ _
| | | | (_)
___| |_ __ _| |_ _ ___
/ __| __/ _` | __| |/ __|
\__ \ || (_| | |_| | (__
|___/\__\__,_|\__|_|\___|
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