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
83c10331
Commit
83c10331
authored
Jul 29, 2015
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test of submission history display
parent
6ba611cb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
0 deletions
+48
-0
lms/djangoapps/courseware/tests/test_views.py
+48
-0
No files found.
lms/djangoapps/courseware/tests/test_views.py
View file @
83c10331
...
...
@@ -8,6 +8,7 @@ import ddt
import
json
import
unittest
from
datetime
import
datetime
from
HTMLParser
import
HTMLParser
from
nose.plugins.attrib
import
attr
from
django.conf
import
settings
...
...
@@ -30,8 +31,10 @@ from certificates import api as certs_api
from
certificates.models
import
CertificateStatuses
,
CertificateGenerationConfiguration
from
certificates.tests.factories
import
GeneratedCertificateFactory
from
course_modes.models
import
CourseMode
from
courseware.model_data
import
set_score
from
courseware.testutils
import
RenderXBlockTestMixin
from
courseware.tests.factories
import
StudentModuleFactory
from
courseware.user_state_client
import
DjangoXBlockUserStateClient
from
edxmako.tests
import
mako_middleware_process_request
from
student.models
import
CourseEnrollment
from
student.tests.factories
import
AdminFactory
,
UserFactory
,
CourseEnrollmentFactory
...
...
@@ -524,6 +527,51 @@ class ViewsTestCase(ModuleStoreTestCase):
response
=
self
.
client
.
get
(
url
)
self
.
assertFalse
(
'<script>'
in
response
.
content
)
def
test_submission_history_contents
(
self
):
# log into a staff account
admin
=
AdminFactory
.
create
()
self
.
client
.
login
(
username
=
admin
.
username
,
password
=
'test'
)
usage_key
=
self
.
course_key
.
make_usage_key
(
'problem'
,
'test-history'
)
state_client
=
DjangoXBlockUserStateClient
(
admin
)
# store state via the UserStateClient
state_client
.
set
(
username
=
admin
.
username
,
block_key
=
usage_key
,
state
=
{
'field_a'
:
'x'
,
'field_b'
:
'y'
}
)
set_score
(
admin
.
id
,
usage_key
,
0
,
3
)
state_client
.
set
(
username
=
admin
.
username
,
block_key
=
usage_key
,
state
=
{
'field_a'
:
'a'
,
'field_b'
:
'b'
}
)
set_score
(
admin
.
id
,
usage_key
,
3
,
3
)
url
=
reverse
(
'submission_history'
,
kwargs
=
{
'course_id'
:
unicode
(
self
.
course_key
),
'student_username'
:
admin
.
username
,
'location'
:
unicode
(
usage_key
),
})
response
=
self
.
client
.
get
(
url
)
response_content
=
HTMLParser
()
.
unescape
(
response
.
content
)
# We have update the state 4 times: twice to change content, and twice
# to set the scores. We'll check that the identifying content from each is
# displayed (but not the order), and also the indexes assigned in the output
# #1 - #4
self
.
assertIn
(
'#1'
,
response_content
)
self
.
assertIn
(
json
.
dumps
({
'field_a'
:
'a'
,
'field_b'
:
'b'
},
sort_keys
=
True
,
indent
=
2
),
response_content
)
self
.
assertIn
(
"Score: 0.0 / 3.0"
,
response_content
)
self
.
assertIn
(
json
.
dumps
({
'field_a'
:
'x'
,
'field_b'
:
'y'
},
sort_keys
=
True
,
indent
=
2
),
response_content
)
self
.
assertIn
(
"Score: 3.0 / 3.0"
,
response_content
)
self
.
assertIn
(
'#4'
,
response_content
)
def
_load_mktg_about
(
self
,
language
=
None
,
org
=
None
):
"""Retrieve the marketing about button (iframed into the marketing site)
and return the HTTP response.
...
...
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