Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
5c2caeff
Commit
5c2caeff
authored
7 years ago
by
Dillon Dumesnil
Browse files
Options
Downloads
Patches
Plain Diff
Quality fixes
parent
a95d26ca
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
openedx/tests/xblock_integration/test_review_xblock.py
+38
-28
38 additions, 28 deletions
openedx/tests/xblock_integration/test_review_xblock.py
with
38 additions
and
28 deletions
openedx/tests/xblock_integration/test_review_xblock.py
+
38
−
28
View file @
5c2caeff
"""
Test scenarios for the review xblock.
"""
import
json
import
unittest
from
django.conf
import
settings
...
...
@@ -15,7 +14,7 @@ from xmodule.modulestore.django import modulestore
from
xmodule.modulestore.tests.django_utils
import
SharedModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
review
import
ReviewXBlock
,
get_review_ids
from
review
import
get_review_ids
import
crum
...
...
@@ -230,13 +229,14 @@ class TestReviewFunctions(TestReviewXBlock):
'
course_id
'
:
self
.
course_actual
.
id
,
'
chapter
'
:
self
.
chapter_actual
.
location
.
name
,
'
section
'
:
self
.
review_section_actual
.
location
.
name
,
}))
}
))
expected_h2
=
'
Nothing to review
'
expected_p
=
'
Oh no! You have not interacted with enough problems yet to have any to review.
'
\
'
Go back and try more problems so you have content to review.
'
self
.
assert
True
(
expected_h2
in
response
.
content
)
self
.
assert
True
(
expected_p
in
response
.
content
)
'
Go back and try more problems so you have content to review.
'
self
.
assert
In
(
expected_h2
,
response
.
content
)
self
.
assert
In
(
expected_p
,
response
.
content
)
def
test_too_few_review_problems
(
self
):
"""
...
...
@@ -258,7 +258,8 @@ class TestReviewFunctions(TestReviewXBlock):
'
course_id
'
:
self
.
course_actual
.
id
,
'
chapter
'
:
self
.
chapter_actual
.
location
.
name
,
'
section
'
:
self
.
section2_actual
.
location
.
name
,
}))
}
))
# Loading the review section
response
=
self
.
client
.
get
(
reverse
(
...
...
@@ -267,14 +268,15 @@ class TestReviewFunctions(TestReviewXBlock):
'
course_id
'
:
self
.
course_actual
.
id
,
'
chapter
'
:
self
.
chapter_actual
.
location
.
name
,
'
section
'
:
self
.
review_section_actual
.
location
.
name
,
}))
}
))
expected_h2
=
'
Nothing to review
'
expected_p
=
'
Oh no! You have not interacted with enough problems yet to have any to review.
'
\
'
Go back and try more problems so you have content to review.
'
'
Go back and try more problems so you have content to review.
'
self
.
assert
True
(
expected_h2
in
response
.
content
)
self
.
assert
True
(
expected_p
in
response
.
content
)
self
.
assert
In
(
expected_h2
,
response
.
content
)
self
.
assert
In
(
expected_p
,
response
.
content
)
def
test_review_problems
(
self
):
"""
...
...
@@ -295,14 +297,16 @@ class TestReviewFunctions(TestReviewXBlock):
'
course_id
'
:
self
.
course_actual
.
id
,
'
chapter
'
:
self
.
chapter_actual
.
location
.
name
,
'
section
'
:
self
.
section1_actual
.
location
.
name
,
}))
}
))
self
.
client
.
get
(
reverse
(
'
courseware_section
'
,
kwargs
=
{
'
course_id
'
:
self
.
course_actual
.
id
,
'
chapter
'
:
self
.
chapter_actual
.
location
.
name
,
'
section
'
:
self
.
section2_actual
.
location
.
name
,
}))
}
))
# Loading the review section
response
=
self
.
client
.
get
(
reverse
(
...
...
@@ -311,24 +315,25 @@ class TestReviewFunctions(TestReviewXBlock):
'
course_id
'
:
self
.
course_actual
.
id
,
'
chapter
'
:
self
.
chapter_actual
.
location
.
name
,
'
section
'
:
self
.
review_section_actual
.
location
.
name
,
}))
}
))
expected_header_text
=
'
Below are 5 review problems for you to try out and see
'
\
'
how well you have mastered the material of this class
'
'
how well you have mastered the material of this class
'
# The problems are defaulted to correct upon load, so the
# correctness text should be displayed as follows
# This happens because the problems "raw_possible" field is 0 and the
# "raw_earned" field is also 0.
expected_correctness_text
=
'
When you originally tried this problem, you ended
'
\
'
up being correct after 0 attempts.
'
'
up being correct after 0 attempts.
'
expected_problems
=
[
'
Review Problem 1
'
,
'
Review Problem 2
'
,
'
Review Problem 3
'
,
'
Review Problem 4
'
,
'
Review Problem 5
'
]
'
Review Problem 4
'
,
'
Review Problem 5
'
]
expected_url_beginning
=
'
https://courses.edx.org/xblock/block-v1:DillonX/DAD101rx/3T2017+type@problem+block@
'
self
.
assert
True
(
expected_header_text
in
response
.
content
)
self
.
assert
In
(
expected_header_text
,
response
.
content
)
self
.
assertEqual
(
response
.
content
.
count
(
expected_correctness_text
),
5
)
for
problem
in
expected_problems
:
self
.
assert
True
(
problem
in
response
.
content
)
self
.
assert
In
(
problem
,
response
.
content
)
self
.
assertEqual
(
response
.
content
.
count
(
expected_url_beginning
),
5
)
def
test_review_problem_urls
(
self
):
...
...
@@ -350,14 +355,16 @@ class TestReviewFunctions(TestReviewXBlock):
'
course_id
'
:
self
.
course_actual
.
id
,
'
chapter
'
:
self
.
chapter_actual
.
location
.
name
,
'
section
'
:
self
.
section1_actual
.
location
.
name
,
}))
}
))
self
.
client
.
get
(
reverse
(
'
courseware_section
'
,
kwargs
=
{
'
course_id
'
:
self
.
course_actual
.
id
,
'
chapter
'
:
self
.
chapter_actual
.
location
.
name
,
'
section
'
:
self
.
section2_actual
.
location
.
name
,
}))
}
))
user
=
User
.
objects
.
get
(
email
=
self
.
STUDENTS
[
0
][
'
email
'
])
crum
.
set_current_user
(
user
)
...
...
@@ -373,7 +380,7 @@ class TestReviewFunctions(TestReviewXBlock):
]
for
url
in
expected_urls
:
self
.
assert
True
(
url
in
result_urls
)
self
.
assert
In
(
url
,
result_urls
)
def
test_review_problem_urls_unique_problem
(
self
):
"""
...
...
@@ -396,14 +403,16 @@ class TestReviewFunctions(TestReviewXBlock):
'
course_id
'
:
self
.
course_actual
.
id
,
'
chapter
'
:
self
.
chapter_actual
.
location
.
name
,
'
section
'
:
self
.
section1_actual
.
location
.
name
,
}))
}
))
self
.
client
.
get
(
reverse
(
'
courseware_section
'
,
kwargs
=
{
'
course_id
'
:
self
.
course_actual
.
id
,
'
chapter
'
:
self
.
chapter_actual
.
location
.
name
,
'
section
'
:
self
.
section3_actual
.
location
.
name
,
}))
}
))
user
=
User
.
objects
.
get
(
email
=
self
.
STUDENTS
[
0
][
'
email
'
])
crum
.
set_current_user
(
user
)
...
...
@@ -421,8 +430,8 @@ class TestReviewFunctions(TestReviewXBlock):
expected_not_loaded_problem
=
(
url_beginning
+
'
i4x://DillonX/DAD101x/problem/Problem_5
'
,
'
correct
'
,
0
)
for
url
in
expected_urls
:
self
.
assert
True
(
url
in
result_urls
)
self
.
assert
False
(
expected_not_loaded_problem
in
result_urls
)
self
.
assert
In
(
url
,
result_urls
)
self
.
assert
NotIn
(
expected_not_loaded_problem
,
result_urls
)
# NOTE: This test is failing because when I grab the problem from the CSM,
# it is unable to find its parents. This is some issue with the BlockStructure
...
...
@@ -444,13 +453,14 @@ class TestReviewFunctions(TestReviewXBlock):
# 'course_id': self.course_actual.id,
# 'chapter': self.chapter_actual.location.name,
# 'section': self.section1_actual.location.name,
# }))
# }
# ))
# user = User.objects.get(email=self.STUDENTS[0]['email'])
# crum.set_current_user(user)
# result_url = get_review_ids.get_vertical(self.course_actual.id)
# expected_url = 'https://courses.edx.org/xblock/block-v1:DillonX/DAD101rx/3T2017+type@'\
#
'vertical+block@i4x://DillonX/DAD101x/chapter/New_Unit_1'
# 'vertical+block@i4x://DillonX/DAD101x/chapter/New_Unit_1'
# self.assertEqual(result_url, expected_url)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment