def testOverallStandings(self): """Test that updating the points in a round changes the mobile standings.""" entry = self.all_entries[1] # Use second place entry. standings = get_mobile_standings(entry.profile.user) test_string = "You are #2 in overall points for %s." % self.current_round diff = self.all_entries[0].points - self.all_entries[1].points if diff < 2: test_string += " Get 1 more point to move to #1." else: test_string += " Get %d more points to move to #1." % diff self.assertEqual(standings["overall"], test_string) entry.points += diff + 1 # Moves user to first place. entry.save() standings = get_mobile_standings(entry.profile.user) test_string = "You are #1 in overall points for %s." % self.current_round self.assertEqual(standings["overall"], test_string)
def testFloorStandings(self): """Test that updating the overall points changes the mobile standings.""" profile = self.floor_profiles[1] # Use second place profile. standings = get_mobile_standings(profile.user) test_string = "You are #2 in points for %s in the competition." % (self.floor) diff = self.floor_profiles[0].points - self.floor_profiles[1].points if diff == 0: diff = 1 test_string += " Get %d more point to move to #1." % diff else: test_string += " Get %d more points to move to #1." % diff self.assertEqual(standings["floor"], test_string) profile.points += diff + 1 # Moves user to first place. profile.save() standings = get_mobile_standings(profile.user) test_string = "You are #1 in points for %s in the competition." % self.floor self.assertEqual(standings["floor"], test_string)
def testOverallStandings(self): """Test that updating the overall points changes the mobile standings.""" profile = self.all_profiles[1] # Use second place entry. standings = get_mobile_standings(profile.user) test_string = "You are #2 in overall points in the competition." diff = self.all_profiles[0].points - self.all_profiles[1].points if diff == 0: diff = 1 test_string += " Get %d more point to move to #1." % diff else: test_string += " Get %d more points to move to #1." % diff self.assertEqual(standings["overall"], test_string) profile.points += diff + 1 # Moves user to first place. profile.save() standings = get_mobile_standings(profile.user) test_string = "You are #1 in overall points in the competition." self.assertEqual(standings["overall"], test_string)