def test_no_assignement_on_mturk_sends_hit_cancelled_message(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
}
mturk = mock.Mock(**{'get_assignment.return_value': []})
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_hit_cancelled_msg.assert_called()
评论列表
文章目录