Ejemplo n.º 1
0
    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")
Ejemplo n.º 2
0
    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")
Ejemplo n.º 3
0
 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")])
Ejemplo n.º 4
0
 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)
Ejemplo n.º 5
0
 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")])
Ejemplo n.º 6
0
 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))
Ejemplo n.º 7
0
 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))
Ejemplo n.º 8
0
 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")
Ejemplo n.º 9
0
 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))
Ejemplo n.º 10
0
 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)
Ejemplo n.º 11
0
 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")
Ejemplo n.º 12
0
 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))