Exemple #1
0
 def test_delete_guest(self):
     signed_user_controller = SignedUserController()
     g1 = Guest("0.0.0.1", 23)
     g2 = Guest("0.0.0.2", 46)
     signed_user_controller.add_user(g1)
     signed_user_controller.add_user(g2)
     signed_user_controller.delete_guest(g1.user_ip)
     """ Cannot be deleted """
     signed_user_controller.delete_guest("0.020.1")
     self.assertEqual(1, signed_user_controller.get_guests().__len__())
     self.assertIsNone(signed_user_controller.get_guests().get("0.0.0.1"))
Exemple #2
0
 def test_add_guest(self):
     signed_user_controller = SignedUserController()
     signed_user_controller.add_guest("0.0.0.1")
     signed_user_controller.add_guest("0.0.0.2")
     self.assertEqual(
         1,
         signed_user_controller.get_guests().get("0.0.0.1").user_id)
     self.assertEqual(
         2,
         signed_user_controller.get_guests().get("0.0.0.2").user_id)
     self.assertIsNone(signed_user_controller.get_guests().get("0.0.02"))
Exemple #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"))
Exemple #4
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__()))