Exemplo n.º 1
0
 def test_toss_dice_ok(self):
     self.login()
     data = {
         'title': 'test_draw',
         'is_shared': True,
         'enable_chat': True,
         'users': ['*****@*****.**'],
         'allow_repeat': True,
         }
     draw = DiceDraw(**data)
     draw.owner = self.user.pk
     self.mongo.save_draw(draw)
     resp = self.toss(draw)
     print(resp)
     self.assertHttpOK(resp)
     draw = self.mongo.retrieve_draw(draw.pk)
     self.assertEqual(1, len(draw.results))
     self.mongo.remove_draw(draw.pk)
Exemplo n.º 2
0
 def test_update_dice_ok(self):
     self.login()
     data = {
         'title': 'test_draw',
         'is_shared': True,
         'enable_chat': True,
         'users': ['*****@*****.**'],
         'allow_repeat': True,
         }
     draw = DiceDraw(**data)
     draw.owner = self.user.pk
     self.mongo.save_draw(draw)
     update_data = {
         'number_of_results': 5
     }
     resp = self.api_client.patch(self.detail_uri(draw), data=update_data)
     print(resp)
     self.assertHttpAccepted(resp)
     draw = self.mongo.retrieve_draw(draw.pk)
     for key, value in update_data.items():
         self.assertEqual(value, getattr(draw, key))
     self.mongo.remove_draw(draw.pk)