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
94f6e685
Commit
94f6e685
authored
Feb 21, 2013
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mock the response from the snuggletex server, and unskip the SymbolicResponse test.
parent
c04f3e09
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
1 deletions
+12
-1
common/lib/capa/capa/tests/test_files/snuggletex_correct.html
+0
-0
common/lib/capa/capa/tests/test_files/snuggletex_wrong.html
+0
-0
common/lib/capa/capa/tests/test_responsetypes.py
+12
-1
No files found.
common/lib/capa/capa/tests/test_files/snuggletex_correct.html
0 → 100644
View file @
94f6e685
This diff is collapsed.
Click to expand it.
common/lib/capa/capa/tests/test_files/snuggletex_wrong.html
0 → 100644
View file @
94f6e685
This diff is collapsed.
Click to expand it.
common/lib/capa/capa/tests/test_responsetypes.py
View file @
94f6e685
...
...
@@ -10,6 +10,7 @@ import os
import
random
import
unittest
import
textwrap
import
mock
from
.
import
test_system
...
...
@@ -186,7 +187,6 @@ class ImageResponseTest(ResponseTest):
class
SymbolicResponseTest
(
unittest
.
TestCase
):
def
test_sr_grade
(
self
):
raise
SkipTest
()
# This test fails due to dependencies on a local copy of snuggletex-webapp. Until we have figured that out, we'll just skip this test
symbolicresponse_file
=
os
.
path
.
dirname
(
__file__
)
+
"/test_files/symbolicresponse.xml"
test_lcp
=
lcp
.
LoncapaProblem
(
open
(
symbolicresponse_file
)
.
read
(),
'1'
,
system
=
test_system
)
correct_answers
=
{
'1_2_1'
:
'cos(theta)*[[1,0],[0,1]] + i*sin(theta)*[[0,1],[1,0]]'
,
...
...
@@ -270,7 +270,18 @@ class SymbolicResponseTest(unittest.TestCase):
</mstyle>
</math>'''
,
}
import
requests
d
=
os
.
path
.
dirname
(
__file__
)
correct_snuggletex_response
=
open
(
os
.
path
.
join
(
d
,
"test_files/snuggletex_correct.html"
))
.
read
()
.
decode
(
'utf8'
)
wrong_snuggletex_response
=
open
(
os
.
path
.
join
(
d
,
"test_files/snuggletex_wrong.html"
))
.
read
()
.
decode
(
'utf8'
)
with
mock
.
patch
.
object
(
requests
,
'post'
)
as
mock_post
:
mock_post
.
return_value
.
text
=
correct_snuggletex_response
self
.
assertEquals
(
test_lcp
.
grade_answers
(
correct_answers
)
.
get_correctness
(
'1_2_1'
),
'correct'
)
with
mock
.
patch
.
object
(
requests
,
'post'
)
as
mock_post
:
mock_post
.
return_value
.
text
=
wrong_snuggletex_response
self
.
assertEquals
(
test_lcp
.
grade_answers
(
wrong_answers
)
.
get_correctness
(
'1_2_1'
),
'incorrect'
)
...
...
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