def test_refresh(self): boto_hit = BotoHITFactory(HITStatus="UPDATED") mturk.connection.get_hit = MagicMock(return_value=[boto_hit]) hit = HITFactory() hit._boto_assignments = [] hit._assignments = [] hit.refresh() assert hit.status == "UPDATED" assert hit._assignments == None assert hit._boto_assignments == None mturk.connection.get_hit.assert_called_once_with(hit.id)
def test_destroy(self): dispose_hit = mturk.connection.dispose_hit = MagicMock() hit = HITFactory() hit.refresh = MagicMock() hit.destroy() dispose_hit.assert_called_once_with(hit.id) assert hit.refresh.called
def test_expire(self): expire_hit = mturk.connection.expire_hit = MagicMock() hit = HITFactory() hit.refresh = MagicMock() hit.expire() expire_hit.assert_called_once_with(hit.id) assert hit.refresh.called