Skip to content

Commit

Permalink
Merge 8ab9672 into f90135c
Browse files Browse the repository at this point in the history
  • Loading branch information
jcdyer committed Mar 29, 2019
2 parents f90135c + 8ab9672 commit 96b5be1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions submissions/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from django.db import DatabaseError, connection, transaction
from django.core.cache import cache
from django.test import TestCase
from django.utils.timezone import now
from freezegun import freeze_time
from nose.tools import raises
import mock
Expand Down Expand Up @@ -263,7 +264,7 @@ def test_error_on_submission_creation(self, mock_filter):

def test_create_non_json_answer(self):
with self.assertRaises(api.SubmissionRequestError):
api.create_submission(STUDENT_ITEM, datetime.datetime.now())
api.create_submission(STUDENT_ITEM, now())

def test_load_non_json_answer(self):
submission = api.create_submission(STUDENT_ITEM, ANSWER_ONE)
Expand Down Expand Up @@ -335,7 +336,7 @@ def test_create_score(self):
self._assert_score(score, 11, 12)
self.assertFalse(ScoreAnnotation.objects.all().exists())

@freeze_time(datetime.datetime.now())
@freeze_time(now())
@mock.patch.object(score_set, 'send')
def test_set_score_signal(self, send_mock):
submission = api.create_submission(STUDENT_ITEM, ANSWER_ONE)
Expand All @@ -349,7 +350,7 @@ def test_set_score_signal(self, send_mock):
anonymous_user_id=STUDENT_ITEM['student_id'],
course_id=STUDENT_ITEM['course_id'],
item_id=STUDENT_ITEM['item_id'],
created_at=datetime.datetime.now().replace(tzinfo=pytz.UTC),
created_at=now(),
)

@ddt.data(u"First score was incorrect", u"☃")
Expand Down Expand Up @@ -396,7 +397,7 @@ def test_get_score_no_student_id(self):
student_item['student_id'] = None
self.assertIs(api.get_score(student_item), None)

@freeze_time(datetime.datetime.now().replace(tzinfo=pytz.UTC))
@freeze_time(now())
def test_get_scores(self):
student_item = copy.deepcopy(STUDENT_ITEM)
student_item["course_id"] = "get_scores_course"
Expand Down Expand Up @@ -426,23 +427,23 @@ def test_get_scores(self):
scores,
{
u'i4x://a/b/c/s1': {
'created_at': datetime.datetime.now(),
'created_at': now(),
'points_earned': 2,
'points_possible': 5,
'student_item': 1,
'submission': 1,
'submission_uuid': s1['uuid'],
},
u'i4x://a/b/c/s2': {
'created_at': datetime.datetime.now(),
'created_at': now(),
'points_earned': 0,
'points_possible': 10,
'student_item': 2,
'submission': 2,
'submission_uuid': s2['uuid'],
},
u'i4x://a/b/c/s3': {
'created_at': datetime.datetime.now(),
'created_at': now(),
'points_earned': 4,
'points_possible': 4,
'student_item': 3,
Expand Down
2 changes: 1 addition & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ddt==1.2.1
django-nose==1.4.6
freezegun==0.1.11
freezegun==0.3.11
mock==2.0.0
nose==1.3.7
coverage==4.5.2
Expand Down

0 comments on commit 96b5be1

Please sign in to comment.