Ejemplo n.º 1
0
 def test_buy_gun_result_correct_charge(self):
     tid=9999
     s=Shop()
     db_test_fill(s)
     p=player()
     p.inventoryPlanes.append(tid)
     p.inventoryGuns[tid]=[] #TODO REMOVE it after bug fix
     p.resources.credits=999
     p.resources.gold=0
     s._Shop__buyGuns(p, tid, 999 )
     self.assertEqual(p.resources.credits, 0,msg="error charging player")
Ejemplo n.º 2
0
 def test_buy_gun_no_enought_resources__result_empty_inventoryPlanes(self):
     s=Shop()
     db_test_fill(s)
     p=player()
     p.inventoryPlanes.append(9999)
     p.inventoryGuns[9999]=[]#TODO REMOVE it after bug fix
     p.resources.credits=0
     p.resources.gold=0
     s._Shop__buyGuns(p, 9999, 999 )
     print "credits - ",p.resources.credits
     self.assertEqual(p.inventoryGuns[9999],[],msg="we suupose user can not buy guns without resources")
Ejemplo n.º 3
0
 def test_buy_several_different_guns_result_several_guns_added(self):
     tid=9999
     s=Shop()
     db_test_fill(s)
     p=player()
     p.inventoryPlanes.append(tid)
     p.inventoryGuns[tid]=[] #TODO REMOVE it after bug fix
     p.resources.credits=999
     p.resources.gold=999
     s._Shop__buyGuns(p, tid, 999 )
     self.assertEqual(p.resources.credits, 0,msg="error charging player")
     s._Shop__buyGuns(p, tid, 998 )
     self.assertEqual(p.resources.gold, 1,msg="error charging player")
     self.assertEqual(p.inventoryGuns, {9999: [999, 998]},msg="error adding guns to player")