def test_show_all_users(self): signed_user_controller = SignedUserController() signed_user_controller.add_guest("0.0.0.1") signed_user_controller.add_guest("0.0.0.3") signed_user_controller.add_guest("0.0.0.3") d1 = datetime.datetime(2020, 4, 23) signed_user_controller.add_signed_user("name_u1", "1234", "ro", d1, "0.0.0.5") l1, l2 = signed_user_controller.show_all_users() self.assertEqual(3, l1.__len__() + l2.__len__())
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"))
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"))
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__()))