Esempio n. 1
0
 def test_add_fan_to_data(self):
     signed_user_controller = SignedUserController()
     d1 = datetime.datetime(2020, 4, 23)
     signed_user_controller.add_fan_to_data("name_u1", "1234", "ro", d1,
                                            "0.0.0.5")
     self.assertTrue(signed_user_controller.get_user("name_u1"))
     self.assertTrue(
         type(signed_user_controller.get_user("name_u1")) is Fan)
Esempio n. 2
0
 def test_add_referee_to_data(self):
     signed_user_controller = SignedUserController()
     d1 = datetime.datetime(2020, 4, 23)
     signed_user_controller.add_referee_to_data(
         RefereeQualificationEnum.MAIN, "name_u1", "1234", "ro", d1,
         "0.0.0.5")
     self.assertTrue(signed_user_controller.get_user("name_u1"))
     self.assertTrue(
         type(signed_user_controller.get_user("name_u1")) is Referee)
Esempio n. 3
0
 def test_edit_personal_name(self):
     signed_user_controller = SignedUserController()
     d1 = datetime.datetime(2020, 4, 23)
     signed_user_controller.add_signed_user("name_u1", "1234", "ro", d1,
                                            "0.0.0.5")
     self.assertTrue(
         signed_user_controller.edit_personal_name("name_u1", "moshe"))
     self.assertNotEqual("ro",
                         signed_user_controller.get_user("name_u1").name)
     self.assertEqual("moshe",
                      signed_user_controller.get_user("name_u1").name)
     self.assertFalse(
         signed_user_controller.edit_personal_name("name21", "moshe"))
Esempio n. 4
0
 def test_edit_personal_birth_date(self):
     signed_user_controller = SignedUserController()
     d1 = datetime.datetime(2020, 4, 23)
     d2 = datetime.datetime(1998, 4, 23)
     signed_user_controller.add_signed_user("name_u1", "1234", "ro", d1,
                                            "0.0.0.5")
     self.assertTrue(
         signed_user_controller.edit_personal_birth_date("name_u1", d2))
     self.assertNotEqual(
         d1,
         signed_user_controller.get_user("name_u1").birth_date)
     self.assertEqual(d2,
                      signed_user_controller.get_user("name_u1").birth_date)
     self.assertFalse(
         signed_user_controller.edit_personal_birth_date("name21", d1))
Esempio n. 5
0
 def test_edit_personal_password(self):
     signed_user_controller = SignedUserController()
     d1 = datetime.datetime(2020, 4, 23)
     old_password = "******"
     new_password = "******"
     signed_user_controller.add_signed_user("name_u1", old_password, "ro",
                                            d1, "0.0.0.5")
     self.assertTrue(
         signed_user_controller.edit_personal_password(
             "name_u1", old_password, new_password))
     self.assertNotEqual(
         str(hashlib.sha256(old_password.encode()).hexdigest()),
         signed_user_controller.get_user("name_u1").password)
     self.assertEqual(
         str(hashlib.sha256(new_password.encode()).hexdigest()),
         signed_user_controller.get_user("name_u1").password)
     self.assertFalse(
         signed_user_controller.edit_personal_password(
             "name1", new_password, old_password))
Esempio n. 6
0
 def test_get_user(self):
     signed_user_controller = SignedUserController()
     d1 = datetime.datetime(2020, 4, 23)
     s = SignedUser("name_u1", "1234", "ro", d1, "0.0.0.5", 23)
     signed_user_controller.add_user(s)
     self.assertEqual(s, signed_user_controller.get_user(s.user_name))