def test_bet_lose_on_eur_wallet(self): wallet_service = WalletService(2) bet_wallet = wallet_service.get_next_wallet_to_bet(2.00) self.assertTrue(wallet_service.process_bet(bet_wallet, 2.00, won=False)) updated_wallet = Wallet.objects.filter(pk=bet_wallet.id).first() self.assertEquals(bet_wallet.amount - Decimal(2.00), updated_wallet.amount) self.assertEquals(2.00, updated_wallet.bet_amount)
def test_bet_won_on_bns_wallet(self): wallet_service = WalletService(3) bet_wallet = wallet_service.get_next_wallet_to_bet(2.00) self.assertTrue(wallet_service.process_bet(bet_wallet, 2.00, won=True)) updated_wallet = Wallet.objects.filter(pk=bet_wallet.id).first() self.assertEquals(bet_wallet.amount + Decimal(2.00), updated_wallet.amount) self.assertEquals(2.00, updated_wallet.bet_amount) self.assertEquals('BNS', updated_wallet.currency)