Пример #1
0
def test_thrift_game_equal_db_game():
	user = helpers.get_user_object()
	game = helpers.get_game_object(user)

	t_user = helpers.get_thrift_user()
	t_game = helpers.get_thrift_game(t_user)

	assert game == t_game
	t_game.game_id = 2
	assert game != t_game
Пример #2
0
def test_add_game_to_db(set_up):
	gh = set_up
	user = helpers.get_user_object()
	gh.session.add(user)
	game = helpers.get_game_object(user)
	game.user = user
	gh.session.add(game)

	game_query = gh.game_query
	assert game_query.first() == game
	assert game_query.get(game.game_id) == game
Пример #3
0
def test_thrift_guess_equal_db_guess():
	user = helpers.get_user_object()
	game = helpers.get_game_object(user)
	guess = helpers.get_guess_object(game)

	t_user = helpers.get_thrift_user()
	t_game = helpers.get_thrift_game(t_user)
	t_guess = helpers.get_thrift_guess(t_game)

	assert guess == t_guess
	t_guess.number = 1000000
	assert guess != t_guess
Пример #4
0
def test_add_guess_to_db(set_up):
	gh = set_up
	user = helpers.get_user_object()
	gh.session.add(user)
	game = helpers.get_game_object(user)
	gh.session.add(game)
	guess = helpers.get_guess_object(game)
	gh.session.add(guess)

	guess_query = gh.guess_query
	assert guess_query.first() == guess
	assert guess_query.get(guess.guess_id) == guess