Exemplo n.º 1
0
 def test_war_result_loss(self):
     """test for user loses scenario"""
     user = Card.objects.create(suit=Card.HEART, rank='four')
     comp = Card.objects.create(suit=Card.HEART, rank='five')
     self.assertEqual(Card.get_war_result(user, comp), -1)
Exemplo n.º 2
0
 def test_get_war_result_usercard_equal_to_dealercard(self):
     """Test that we get the proper result for usercard equal to dealercard"""
     dealercard = Card.objects.create(suit=Card.CLUB, rank="jack")
     result = Card.get_war_result(self.card, dealercard)
     self.assertEqual(result, 0)
Exemplo n.º 3
0
 def test_war_result_draw(self):
     """test for draw scenario"""
     user = Card.objects.create(suit=Card.HEART, rank='five')
     comp = Card.objects.create(suit=Card.HEART, rank='five')
     self.assertEqual(Card.get_war_result(user, comp), 0)
Exemplo n.º 4
0
 def test_get_war_result_usercard_less_than_dealercard(self):
     """Test that we get the proper result for usercard less than dealercard"""
     dealercard = Card.objects.create(suit=Card.CLUB, rank="ace")
     result = Card.get_war_result(self.card, dealercard)
     self.assertEqual(result, -1)