def test_already_exists(self): self.assertTrue(add_participation( self.user.username, self.contest.id, None, None, None, "pwd", "bcrypt", False, None, False, False, None)) self.assertParticipationInDb(self.user.id, self.contest.id, "pwd") # Second add_participation should fail without changing values. self.assertFalse(add_participation( self.user.username, self.contest.id + 1, "1.2.3.4", 60, 120, "other_pwd", "plaintext", True, self.team.code, True, True, None)) self.assertParticipationInDb(self.user.id, self.contest.id, "pwd")
def test_already_exists(self): self.assertTrue( add_participation(self.user.username, self.contest.id, None, None, None, "pwd", "bcrypt", False, None, False, False, None)) self.assertParticipationInDb(self.user.id, self.contest.id, "pwd") # Second add_participation should fail without changing values. self.assertFalse( add_participation(self.user.username, self.contest.id + 1, "1.2.3.4", 60, 120, "other_pwd", "plaintext", True, self.team.code, True, True, None)) self.assertParticipationInDb(self.user.id, self.contest.id, "pwd")
def test_other_values(self): self.assertTrue(add_participation( self.user.username, self.contest.id, "1.2.3.4", 60, 120, "pwd", "plaintext", True, None, True, True, None)) self.assertParticipationInDb(self.user.id, self.contest.id, "pwd", delay_time=60, extra_time=120, hidden=True, unrestricted=True, ip=[ipaddress.ip_network("1.2.3.4")])
def test_success_with_team(self): self.assertTrue( add_participation(self.user.username, self.contest.id, None, None, None, "pwd", "bcrypt", False, self.team.code, False, False, None)) self.assertParticipationInDb(self.user.id, self.contest.id, "pwd", team_code=self.team.code)
def test_other_values(self): self.assertTrue( add_participation(self.user.username, self.contest.id, "1.2.3.4", 60, 120, "pwd", "plaintext", True, None, True, True, None)) self.assertParticipationInDb(self.user.id, self.contest.id, "pwd", delay_time=60, extra_time=120, hidden=True, unrestricted=True, ip=[ipaddress.ip_network("1.2.3.4")])
def test_team_not_found(self): self.assertFalse( add_participation(self.user.username, self.contest.id, None, None, None, "pwd", "bcrypt", False, self.team.code + "_", False, False, None))
def test_contest_not_found(self): self.assertFalse( add_participation(self.user.username, self.contest.id + 1, None, None, None, "pwd", "bcrypt", False, None, False, False, None))
def test_success(self): self.assertTrue( add_participation(self.user.username, self.contest.id, None, None, None, "pwd", "bcrypt", False, None, False, False, self.contest.main_group.name)) self.assertParticipationInDb(self.user.id, self.contest.id, "pwd")
def test_contest_not_found(self): self.assertFalse(add_participation( self.user.username, self.contest.id + 1, None, None, None, "pwd", "bcrypt", False, None, False, False, None))
def test_success_with_team(self): self.assertTrue(add_participation( self.user.username, self.contest.id, None, None, None, "pwd", "bcrypt", False, self.team.code, False, False, None)) self.assertParticipationInDb(self.user.id, self.contest.id, "pwd", team_code=self.team.code)
def test_success(self): self.assertTrue(add_participation( self.user.username, self.contest.id, None, None, None, "pwd", "bcrypt", False, None, False, False, self.contest.main_group.name)) self.assertParticipationInDb(self.user.id, self.contest.id, "pwd")
def test_team_not_found(self): self.assertFalse(add_participation( self.user.username, self.contest.id, None, None, None, "pwd", "bcrypt", False, self.team.code + "_", False, False, None))