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
a6148856
Commit
a6148856
authored
Aug 10, 2012
by
Victor Shnayder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make the tests work around the 404 bug
parent
c3814a81
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
lms/djangoapps/courseware/tests/tests.py
+11
-5
No files found.
lms/djangoapps/courseware/tests/tests.py
View file @
a6148856
...
@@ -15,6 +15,7 @@ from override_settings import override_settings
...
@@ -15,6 +15,7 @@ from override_settings import override_settings
from
django.contrib.auth.models
import
User
,
Group
from
django.contrib.auth.models
import
User
,
Group
from
student.models
import
Registration
from
student.models
import
Registration
from
courseware.courses
import
course_staff_group_name
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.django
import
modulestore
import
xmodule.modulestore.django
import
xmodule.modulestore.django
...
@@ -217,7 +218,7 @@ class TestInstructorAuth(PageLoader):
...
@@ -217,7 +218,7 @@ class TestInstructorAuth(PageLoader):
import_from_xml
(
modulestore
(),
TEST_DATA_DIR
,
[
'toy'
])
import_from_xml
(
modulestore
(),
TEST_DATA_DIR
,
[
'toy'
])
import_from_xml
(
modulestore
(),
TEST_DATA_DIR
,
[
'full'
])
import_from_xml
(
modulestore
(),
TEST_DATA_DIR
,
[
'full'
])
courses
=
modulestore
()
.
get_courses
()
courses
=
modulestore
()
.
get_courses
()
#
hack to get the two courses
out
#
get the two courses sorted
out
courses
.
sort
(
key
=
lambda
c
:
c
.
location
.
course
)
courses
.
sort
(
key
=
lambda
c
:
c
.
location
.
course
)
[
self
.
full
,
self
.
toy
]
=
courses
[
self
.
full
,
self
.
toy
]
=
courses
...
@@ -232,7 +233,13 @@ class TestInstructorAuth(PageLoader):
...
@@ -232,7 +233,13 @@ class TestInstructorAuth(PageLoader):
def
check_for_get_code
(
self
,
code
,
url
):
def
check_for_get_code
(
self
,
code
,
url
):
resp
=
self
.
client
.
get
(
url
)
resp
=
self
.
client
.
get
(
url
)
self
.
assertEqual
(
resp
.
status_code
,
code
)
# HACK: workaround the bug that returns 200 instead of 404.
# TODO (vshnayder): once we're returning 404s, get rid of this if.
if
code
!=
404
:
self
.
assertEqual
(
resp
.
status_code
,
code
)
else
:
# look for "page not found" instead of the status code
self
.
assertTrue
(
resp
.
content
.
lower
()
.
find
(
'page not found'
)
!=
-
1
)
def
test_instructor_page
(
self
):
def
test_instructor_page
(
self
):
"Make sure only instructors can load it"
"Make sure only instructors can load it"
...
@@ -248,15 +255,14 @@ class TestInstructorAuth(PageLoader):
...
@@ -248,15 +255,14 @@ class TestInstructorAuth(PageLoader):
# TODO: Disabled rest of test for now. Fix once raising a 404 actually
# TODO: Disabled rest of test for now. Fix once raising a 404 actually
# returns a 404 to the client
# returns a 404 to the client
raise
SkipTest
def
instructor_urls
(
course
):
def
instructor_urls
(
course
):
urls
=
[
reverse
(
name
,
kwargs
=
{
'course_id'
:
course
.
id
})
for
name
in
(
urls
=
[
reverse
(
name
,
kwargs
=
{
'course_id'
:
course
.
id
})
for
name
in
(
'instructor_dashboard'
,
'instructor_dashboard'
,
'gradebook'
,
'gradebook'
,
'grade_summary'
,)]
'grade_summary'
,)]
urls
+=
reverse
(
student_profile
,
kwargs
=
{
'course_id'
:
course
.
id
,
urls
.
append
(
reverse
(
'student_profile'
,
kwargs
=
{
'course_id'
:
course
.
id
,
'student_id'
:
user
(
self
.
student
)
.
id
})
'student_id'
:
user
(
self
.
student
)
.
id
})
)
return
urls
return
urls
# shouldn't be able to get to the instructor pages
# shouldn't be able to get to the instructor pages
...
...
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