Пример #1
0
 def test_delete_signed_user(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")
     signed_user_controller.add_signed_user("name_u2", "1234", "ro", d2,
                                            "0.0.0.6")
     signed_user_controller.delete_signed_user("name_u1")
     signed_user_controller.delete_signed_user("name_u12")
     self.assertEqual(1,
                      signed_user_controller.get_signed_users().__len__())
     self.assertIsNone(
         signed_user_controller.get_signed_users().get("name_u1"))
Пример #2
0
 def test_add_signed_user(self):
     signed_user_controller = SignedUserController()
     signed_user_controller.add_guest("0.0.0.1")
     signed_user_controller.add_guest("0.0.0.1")
     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")
     signed_user_controller.add_signed_user("name_u2", "1234", "ro", d2,
                                            "0.0.0.6")
     self.assertIsNotNone(
         signed_user_controller.get_signed_users().get("name_u1").user_id)
     self.assertEqual(3, (signed_user_controller.get_guests().__len__()) +
                      (signed_user_controller.get_signed_users().__len__()))
Пример #3
0
 def test_add_user(self):
     signed_user_controller = SignedUserController()
     d1 = datetime.datetime(2020, 4, 23)
     s_u = SignedUser("name_u1", "1234", "ro", d1, "0.0.0.5", 23)
     g = Guest("0.0.0.1", 23)
     signed_user_controller.add_user(s_u)
     signed_user_controller.add_user(g)
     self.assertEqual(2, (signed_user_controller.get_guests().__len__()) +
                      (signed_user_controller.get_signed_users().__len__()))
     self.assertIsNotNone(
         signed_user_controller.get_signed_users().get("name_u1"))
     self.assertIsNotNone(
         signed_user_controller.get_guests().get("0.0.0.1"))
     self.assertIsNone(
         signed_user_controller.get_signed_users().get("0.0.0.1"))
Пример #4
0
 def test_add_system_admin(self):
     """
     test if the admin in the DB
     If we ran all test its check that ID of the guest is not getting up when we got same guest
     @return:
     """
     signed_user_controller = SignedUserController()
     signed_user_controller.add_guest("0.0.0.1")
     d = datetime.datetime(2020, 4, 23)
     signed_user_controller.add_system_admin("name_u0", "1234", "ro", d,
                                             "0.0.0.5")
     self.assertIsNotNone(
         signed_user_controller.get_signed_users().get("name_u0"))