Пример #1
0
def payTicket(position, player, owner):
    playerMoney = dbfunctions.getAccountBalance(player)
    price = dbfunctions.getTicketPrice(position, owner)
    if (playerMoney > price):
        dbfunctions.updateAccountBalance(player, -price)
        dbfunctions.updateAccountBalance(owner, price)
        return "Zaplaciles " + str(price) + " graczowi " + str(player)

    else:
        # TO DO
        # Opcja zastaw
        return "Nie masz wystarczajacych srodkow"
Пример #2
0
 def test_payRent(self):
     game.payRent(6, 2, 3)
     self.assertEqual(dbfunctions.getAccountBalance(2), 1494)
     self.assertEqual(dbfunctions.getAccountBalance(3), 1506)
Пример #3
0
 def test_changeAccount(self):
     prev = dbfunctions.getAccountBalance(1)
     dbfunctions.updateAccountBalance(1, -200)
     curr = dbfunctions.getAccountBalance(1)
     self.assertEqual(prev - 200, curr)
Пример #4
0
 def test_buyStreet(self):
     game.buyStreet(7, 3)
     self.assertEqual(dbfunctions.getAccountBalance(3), 1500 - 120)
     self.assertEqual(dbfunctions.getOwner(7), 3)
Пример #5
0
 def test_changeAccount2(self):
     dbfunctions.updateAccountBalance(1, -200)
     self.assertEqual(dbfunctions.getAccountBalance(1), 1300)