def testPlayerValidBid(self): """Valid bid within the min / max bid values""" move = self.bid(250) state = self.state() minigame = Auction() self.assertTrue(minigame.run(move, state), minigame.errors())
def testPlayerValidPass(self): """Player tries passing""" move = self.bid() state = self.state() minigame = Auction() self.assertTrue(minigame.run(move, state), minigame.errors()) self.assertEqual(len(state.auction), 1) self.assertEqual(state.auction[0], ("A", 0))
def testPlayerInvalidPass(self): """Owner tries passing""" move = self.bid() state = self.state() move.player_id = state.players[5].id minigame = Auction() self.assertFalse(minigame.run(move, state), minigame.errors()) self.assertEqual(len(state.auction), 0) self.assertIn("You can't pass (or bid) on your own company.", minigame.errors())
def testPlayerBidTooLarge(self): move = self.bid(1000) state = self.state() minigame = Auction() # You can't bid on a company that is not up for auction self.assertFalse(minigame.run(move, state), minigame.errors()) self.assertIn( "You are paying too much. Your bid must be 1/2 to 2 times the price of the company (125 to 500).", minigame.errors() )
def testPlayerInsufficientCashBid(self): """Player don't have enough cash to bid this much.""" move = self.bid(650) state = self.state() minigame = Auction() self.assertFalse(minigame.run(move, state), minigame.errors()) self.assertIn( "You cannot afford poorboi. 650 (You have: 500)", minigame.errors() )
def testPlayerSelfBid(self): """You cannot bid on your own company""" move = self.bid(500) state = self.state() move.player_id = state.auctioned_private_company.belongs_to.id minigame = Auction() self.assertFalse(minigame.run(move, state), minigame.errors()) self.assertIn( "You can't bid on your own company.", minigame.errors() )
def testPlayerWrongCompanyBid(self): """Player bid on a company that is not up for bidding.""" move = self.bid(500) state = self.state() move.private_company_id = 2 move.private_company = state.private_companies[1] minigame = Auction() self.assertFalse(minigame.run(move, state), minigame.errors()) self.assertIn( "You are bidding on the wrong company numbnuts. Fake company 2 vs. Fake company 1 Probably something wrong with your UI system.", minigame.errors() )