def test_sends_notification_if_resubmitted(self, run_check):
# Include whimsical set to True to avoid error in the False code branch:
config = {
'duration': 1.0,
'host': 'fakehost.herokuapp.com',
'whimsical': False
}
fake_assignment = mock.Mock(AssignmentStatus='Submitted')
mturk = mock.Mock(**{'get_assignment.return_value': [fake_assignment]})
participants = [self.a.participant()]
session = None
# Move the clock forward so assignment is overdue:
reference_time = datetime.datetime.now() + datetime.timedelta(hours=6)
mock_messager = mock.Mock(spec=NullHITMessager)
with mock.patch.multiple('dallinger.heroku.clock',
requests=mock.DEFAULT,
NullHITMessager=mock.DEFAULT) as mocks:
mocks['NullHITMessager'].return_value = mock_messager
run_check(config, mturk, participants, session, reference_time)
mock_messager.send_resubmitted_msg.assert_called()
评论列表
文章目录