Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-ora2
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-ora2
Commits
7ba55cc9
Commit
7ba55cc9
authored
May 07, 2015
by
Waheed Ahmed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed NoneType value for days_early_for_beta and added a unit test.
TNL-2139
parent
a710f0dc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
8 deletions
+30
-8
openassessment/xblock/openassessmentblock.py
+5
-3
openassessment/xblock/test/test_openassessment.py
+25
-5
No files found.
openassessment/xblock/openassessmentblock.py
View file @
7ba55cc9
...
...
@@ -829,9 +829,11 @@ class OpenAssessmentBlock(
def
_adjust_start_date_for_beta_testers
(
self
,
start
):
if
hasattr
(
self
,
"xmodule_runtime"
):
delta
=
dt
.
timedelta
(
getattr
(
self
.
xmodule_runtime
,
'days_early_for_beta'
,
0
))
effective
=
start
-
delta
return
effective
days_early_for_beta
=
getattr
(
self
.
xmodule_runtime
,
'days_early_for_beta'
,
0
)
if
days_early_for_beta
is
not
None
:
delta
=
dt
.
timedelta
(
days_early_for_beta
)
effective
=
start
-
delta
return
effective
return
start
openassessment/xblock/test/test_openassessment.py
View file @
7ba55cc9
...
...
@@ -119,20 +119,19 @@ class TestOpenAssessment(XBlockHandlerTestCase):
self
.
assertTrue
(
resp
.
body
.
find
(
'Tuesday, April 01, 2014'
))
self
.
assertTrue
(
resp
.
body
.
find
(
'Thursday, May 01, 2014'
))
@patch.object
(
openassessmentblock
.
OpenAssessmentBlock
,
'is_beta_tester'
,
new_callable
=
PropertyMock
)
@scenario
(
'data/basic_scenario.xml'
)
def
test_formatted_dates_for_beta_tester_with_days_early
(
self
,
xblock
,
mock_is_beta_tester
):
def
test_formatted_dates_for_beta_tester_with_days_early
(
self
,
xblock
):
"""Test dates for beta tester with days early"""
mock_is_beta_tester
.
return_value
=
True
# Set start/due dates
xblock
.
start
=
dt
.
datetime
(
2014
,
4
,
6
,
1
,
1
,
1
)
xblock
.
due
=
dt
.
datetime
(
2014
,
5
,
1
)
xblock
.
xmodule_runtime
=
Mock
(
course_id
=
'test_course'
,
anonymous_student_id
=
'test_student'
,
days_early_for_beta
=
5
days_early_for_beta
=
5
,
user_is_staff
=
False
,
user_is_beta_tester
=
True
)
self
.
assertEqual
(
xblock
.
xmodule_runtime
.
days_early_for_beta
,
5
)
request
=
namedtuple
(
'Request'
,
'params'
)
...
...
@@ -157,6 +156,27 @@ class TestOpenAssessment(XBlockHandlerTestCase):
self
.
assertTrue
(
resp
.
body
.
find
(
'Tuesday, April 06, 2014'
))
self
.
assertTrue
(
resp
.
body
.
find
(
'Thursday, May 01, 2014'
))
@scenario
(
'data/basic_scenario.xml'
)
def
test_formatted_dates_for_beta_tester_with_nonetype_days_early
(
self
,
xblock
):
"""Test dates for beta tester with NoneType days early"""
# Set start/due dates
xblock
.
start
=
dt
.
datetime
(
2014
,
4
,
6
,
1
,
1
,
1
)
xblock
.
due
=
dt
.
datetime
(
2014
,
5
,
1
)
xblock
.
xmodule_runtime
=
Mock
(
course_id
=
'test_course'
,
anonymous_student_id
=
'test_student'
,
days_early_for_beta
=
None
,
user_is_staff
=
False
,
user_is_beta_tester
=
True
)
self
.
assertEqual
(
xblock
.
xmodule_runtime
.
days_early_for_beta
,
None
)
request
=
namedtuple
(
'Request'
,
'params'
)
request
.
params
=
{}
resp
=
xblock
.
render_peer_assessment
(
request
)
self
.
assertTrue
(
resp
.
body
.
find
(
'Tuesday, April 06, 2014'
))
self
.
assertTrue
(
resp
.
body
.
find
(
'Thursday, May 01, 2014'
))
@scenario
(
'data/basic_scenario.xml'
,
user_id
=
'Bob'
)
def
test_default_fields
(
self
,
xblock
):
...
...
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