Beispiel #1
0
 def test_userPurchaseDeductsBalance(self):
     user = User()
     user.resources.science._value = 100
     bal = Balance(science=Cost(-10,0))
     assert(user.affords(bal))
     user.purchase(balance=bal)
     val = user.resources.science._value
     self.assertEqual(val,90)
Beispiel #2
0
 def test_userCanAffordValue_returns_true(self):
     user = User()
     user.resources.science._value = 100
     bal = Balance(science=Cost(-10,0))
     val = user.resources.science._value
     print val
     self.assertTrue(user.purchase(balance=bal))
Beispiel #3
0
 def test_userCannotAffordValue_returns_false(self):
     user = User()
     bal = Balance(science=Cost(-10,0))
     assert(user.resources.science._value+bal.science.oneTime<=0)
     self.assertFalse(user.purchase(balance=bal))