def test_user_game_relation_user(): """ Test user-game relationship from a user viewpoint. """ user = users.get("test_user") game = games.get("Flingler") game2 = games.get("Flingler II") user.games.append(game) user.games.append(game2) assert game in user.games assert game2 in user.games
def test_calculate_rating_correct(): """ Test if rating is calculated correctly. """ game = games.get("Flingler") rating = ratings.calculate(game) assert 3.0 == rating
def test_plat_game_relation_plat(): """ Test platform-game relationship from a platform viewpoint. """ platform = platforms.get("Android") game = games.get("Flingler") assert game in platform.games
def test_delete_game(): """ Test game deleting. """ game = games.get("Flingler") game.delete() assert_raises(exceptions.NonExistentGame, games.get, "Flingler")
def test_game_event(): """ Test event game adding """ event = events.get(1) game = games.get(1) event.games.append(game) assert game in event.games
def test_plat_game_relation_game(): """ Test platform-game relationship from a game viewpoint. """ game = games.get("Flingler") platform = platforms.get("Windows") platform2 = platforms.get("Android") game.platforms.append(platform) game.platforms.append(platform2) assert platform in game.platforms assert platform2 in game.platforms
def test_game_add_rating(): """ Test adding ratings to a game. """ game = games.get("Flingler") rating = ratings.get(1) rating2 = ratings.get(2) rating3 = rating.get(3) game.ratings.append(rating) game.ratings.append(rating2) game.ratings.append(rating3) assert rating in game.ratings assert rating3 in game.ratings
def test_user_game_relation_game(): """ Test user-game relationship from a game viewpoint. """ game = games.get("Flingler") assert game.author.name == "test_user"
def test_game_get_correct(): """ Test game getting. """ game = games.get("Flingler") assert type(game) == models.Game