def testFloorStandingsWithDorm(self): """Test getting the standings for a dorm.""" dorm = Dorm.objects.all()[0] json_standings = get_individual_standings(dorm=dorm) decoded_standings = json.loads(json_standings) # Verify that the returned structure is correct. self.assertTrue(decoded_standings.has_key("title")) self.assertTrue(decoded_standings.has_key("info")) # Verify that the contents are correct. self.assertEqual(decoded_standings["title"], "%s: Overall" % dorm.name, "Test that correct title is generated.") first = decoded_standings["info"][0] second = decoded_standings["info"][1] self.assertTrue(first["points"] >= second["points"])
def testFloorStandingsWithDorm(self): """Test getting the standings for a dorm.""" dorm = Dorm.objects.all()[0] json_standings = get_individual_standings(dorm=dorm, ) decoded_standings = json.loads(json_standings) # Verify that the returned structure is correct. self.assertTrue(decoded_standings.has_key("title")) self.assertTrue(decoded_standings.has_key("info")) # Verify that the contents are correct. self.assertEqual(decoded_standings["title"], "%s: Overall" % dorm.name, "Test that correct title is generated.") first = decoded_standings["info"][0] second = decoded_standings["info"][1] self.assertTrue(first["points"] >= second["points"])
def testUserStandingsForRound(self): """Test the standings for a round.""" json_standings = get_individual_standings( round_name=self.current_round) decoded_standings = json.loads(json_standings) # Verify that the returned structure is correct. self.assertTrue(decoded_standings.has_key("title")) self.assertTrue(decoded_standings.has_key("info")) # Verify that the contents are correct. self.assertEqual(decoded_standings["title"], "%s: %s" % (self.title_prefix, self.current_round), "Test that correct title is generated.") first = decoded_standings["info"][0] second = decoded_standings["info"][1] self.assertTrue(first["points"] >= second["points"])
def testUserStandingsOverall(self): json_standings = get_individual_standings() decoded_standings = json.loads(json_standings) # Verify that the returned structure is correct. self.assertTrue(decoded_standings.has_key("title")) self.assertTrue(decoded_standings.has_key("info")) # Verify that the contents are correct. self.assertEqual( len(decoded_standings["info"]), MAX_INDIVIDUAL_STANDINGS, "Test that the correct number of individuals is generated.") self.assertEqual(decoded_standings["title"], "%s: Overall" % self.title_prefix, "Test that correct title is generated.") first = decoded_standings["info"][0] second = decoded_standings["info"][1] self.assertTrue(first["points"] >= second["points"])
def testUserStandingsForRound(self): """Test the standings for a round.""" json_standings = get_individual_standings(round_name=self.current_round) decoded_standings = json.loads(json_standings) # Verify that the returned structure is correct. self.assertTrue(decoded_standings.has_key("title")) self.assertTrue(decoded_standings.has_key("info")) # Verify that the contents are correct. self.assertEqual( decoded_standings["title"], "%s: %s" % (self.title_prefix, self.current_round), "Test that correct title is generated.", ) first = decoded_standings["info"][0] second = decoded_standings["info"][1] self.assertTrue(first["points"] >= second["points"])
def testUserStandingsOverall(self): json_standings = get_individual_standings() decoded_standings = json.loads(json_standings) # Verify that the returned structure is correct. self.assertTrue(decoded_standings.has_key("title")) self.assertTrue(decoded_standings.has_key("info")) # Verify that the contents are correct. self.assertEqual( len(decoded_standings["info"]), MAX_INDIVIDUAL_STANDINGS, "Test that the correct number of individuals is generated.", ) self.assertEqual( decoded_standings["title"], "%s: Overall" % self.title_prefix, "Test that correct title is generated." ) first = decoded_standings["info"][0] second = decoded_standings["info"][1] self.assertTrue(first["points"] >= second["points"])