def test01_get_game_by_id(self): game_id = yield self.create_game() connector = CardstoriesServiceConnector(self.service) game, players_ids = yield connector.get_game_by_id(game_id, self.owner_id) self.assertEqual(game['id'], game_id) self.assertEqual(players_ids, [self.owner_id])
def test03_get_game_id_from_args(self): connector = CardstoriesServiceConnector(self.service) game_id = connector.get_game_id_from_args({}) self.assertEqual(game_id, None) game_id = connector.get_game_id_from_args({'game_id': ['undefined']}) self.assertEqual(game_id, None) game_id = connector.get_game_id_from_args({'game_id': ['3']}) self.assertEqual(game_id, 3) game_id = connector.get_game_id_from_args({'game_id': [4]}) self.assertEqual(game_id, 4)
def test02_get_players_by_game_id(self): game_id = yield self.create_game() connector = CardstoriesServiceConnector(self.service) players_ids = yield connector.get_players_by_game_id(game_id) self.assertEqual(players_ids, [self.owner_id])