Ejemplo n.º 1
0
 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
Ejemplo n.º 2
0
 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
Ejemplo n.º 3
0
 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)