Adds test for [#24] (challenges being counted multiple times for the same team). Currently failing.

This commit is contained in:
Louis Fogel 2014-11-02 13:48:37 -05:00
parent 1a3717ae84
commit 42985176cf

View File

@ -102,6 +102,23 @@ def test_leaderboard_sorts_by_points(challenge, player_factory, fresh_team):
len(leaderboard) == 2)
@pytest.mark.django_db
def test_leaderboard_counts_challenges_once(challenge, player_factory, fresh_team):
other_challenge = Challenge(points=300, name="Challenge2")
other_challenge.save()
other_team = Team(name="Team with Score", creator=player_factory.get())
other_team.save()
member = Player(username='player', password='', team=other_team)
member.save()
Solution(challenge=challenge, solver=member).save()
Solution(challenge=challenge, solver=other_team.creator).save()
Solution(challenge=other_challenge, solver=fresh_team.creator).save()
leaderboard = Team.get_leaderboard()
assert (leaderboard[0] == other_team and
leaderboard[1] == fresh_team and
len(leaderboard) == 2)
@pytest.mark.django_db
def test_leaderboard_sorts_by_points_and_time(challenge, player_factory, fresh_team):
team1 = Team(name="1st Team with Score", creator=player_factory.get())