def testManagerShouldBeAbleToBeNone(self): table = tienlen.table.Table(name='table1', manager=None) p1 = mock.Mock() p1.name = 'A' p2 = mock.Mock() p2.name = 'B' table.sit_player(0, p1) table.sit_player(3, p2) table.start_game() self.assertTrue(isinstance(table.game.game_id, int))
def testStartValidGameShouldBeValid(self): gameManager = mock.Mock() gameManager.next_game_id.return_value = 123 table = tienlen.table.Table(name='table0A1', manager=gameManager) p1 = mock.Mock() p1.name = 'A' p2 = mock.Mock() p2.name = 'B' table.sit_player(0, p1) table.sit_player(3, p2) table.start_game() self.assertEqual(table.game.game_id, 123) self.assertEqual(1, gameManager.next_game_id.call_count)