def test_update_display_name(self):
        user_id1 = self.create_user_test1()
        self.assertIsNotNone(user_id1)

        user1 = UserManagementInterface.read_user_by_id(user_id1)

        self.assertEqual(user1["id"], user_id1)
        self.assertEqual(user1["user_name"], "test1")
        self.assertEqual(user1["display_name"], "Test 1")
        self.assertEqual(user1["email"], "*****@*****.**")
        self.assertEqual(user1["active"], True)

        user_id2 = self.create_user_test2()
        self.assertIsNotNone(user_id2)

        user2 = UserManagementInterface.read_user_by_id(user_id2)

        self.assertEqual(user2["id"], user_id2)
        self.assertEqual(user2["user_name"], "test2")
        self.assertEqual(user2["display_name"], "Test 2")
        self.assertEqual(user2["email"], "*****@*****.**")
        self.assertEqual(user2["active"], True)

        # Positive tests ---------------------------------------------------------------------------
        self.assertTrue(UserManagementInterface.update_user_information(user_id2,
                                                                        user2["user_name"],
                                                                        "Test New",
                                                                        user2["email"],
                                                                        user2["active"]))

        user2 = UserManagementInterface.read_user_by_id(user_id2)

        self.assertEqual(user2["id"], user_id2)
        self.assertEqual(user2["user_name"], "test2")
        self.assertEqual(user2["display_name"], "Test New")
        self.assertEqual(user2["email"], "*****@*****.**")
        self.assertEqual(user2["active"], True)

        # Negative tests ---------------------------------------------------------------------------
        # Try to update a user with an invalid display name
        self.assertFalse(UserManagementInterface.update_user_information(user_id2,
                                                                         user2["user_name"],
                                                                         "",
                                                                         user2["email"],
                                                                         user2["active"]))

        # Try to update a user with the same display name as another user
        self.assertFalse(UserManagementInterface.update_user_information(user_id2,
                                                                         user2["user_name"],
                                                                         user1["display_name"],
                                                                         user2["email"],
                                                                         user2["active"]))
    def test_update_display_name(self):
        user_id1 = self.create_user_test1()
        self.assertIsNotNone(user_id1)

        user1 = UserManagementInterface.read_user_by_id(user_id1)

        self.assertEqual(user1["id"], user_id1)
        self.assertEqual(user1["user_name"], "test1")
        self.assertEqual(user1["display_name"], "Test 1")
        self.assertEqual(user1["email"], "*****@*****.**")
        self.assertEqual(user1["active"], True)

        user_id2 = self.create_user_test2()
        self.assertIsNotNone(user_id2)

        user2 = UserManagementInterface.read_user_by_id(user_id2)

        self.assertEqual(user2["id"], user_id2)
        self.assertEqual(user2["user_name"], "test2")
        self.assertEqual(user2["display_name"], "Test 2")
        self.assertEqual(user2["email"], "*****@*****.**")
        self.assertEqual(user2["active"], True)

        # Positive tests ---------------------------------------------------------------------------
        self.assertTrue(
            UserManagementInterface.update_user_information(
                user_id2, user2["user_name"], "Test New", user2["email"],
                user2["active"]))

        user2 = UserManagementInterface.read_user_by_id(user_id2)

        self.assertEqual(user2["id"], user_id2)
        self.assertEqual(user2["user_name"], "test2")
        self.assertEqual(user2["display_name"], "Test New")
        self.assertEqual(user2["email"], "*****@*****.**")
        self.assertEqual(user2["active"], True)

        # Negative tests ---------------------------------------------------------------------------
        # Try to update a user with an invalid display name
        self.assertFalse(
            UserManagementInterface.update_user_information(
                user_id2, user2["user_name"], "", user2["email"],
                user2["active"]))

        # Try to update a user with the same display name as another user
        self.assertFalse(
            UserManagementInterface.update_user_information(
                user_id2, user2["user_name"], user1["display_name"],
                user2["email"], user2["active"]))
    def test_update_email(self):
        user_id2 = self.create_user_test2()
        self.assertIsNotNone(user_id2)

        user2 = UserManagementInterface.read_user_by_id(user_id2)

        self.assertEqual(user2["id"], user_id2)
        self.assertEqual(user2["user_name"], "test2")
        self.assertEqual(user2["display_name"], "Test 2")
        self.assertEqual(user2["email"], "*****@*****.**")
        self.assertEqual(user2["active"], True)

        # Positive tests ---------------------------------------------------------------------------
        self.assertTrue(
            UserManagementInterface.update_user_information(
                user_id2, user2["user_name"], user2["display_name"],
                "*****@*****.**", user2["active"]))

        user2 = UserManagementInterface.read_user_by_id(user_id2)

        self.assertEqual(user2["id"], user_id2)
        self.assertEqual(user2["user_name"], "test2")
        self.assertEqual(user2["display_name"], "Test 2")
        self.assertEqual(user2["email"], "*****@*****.**")
        self.assertEqual(user2["active"], True)
    def test_update_email(self):
        user_id2 = self.create_user_test2()
        self.assertIsNotNone(user_id2)

        user2 = UserManagementInterface.read_user_by_id(user_id2)

        self.assertEqual(user2["id"], user_id2)
        self.assertEqual(user2["user_name"], "test2")
        self.assertEqual(user2["display_name"], "Test 2")
        self.assertEqual(user2["email"], "*****@*****.**")
        self.assertEqual(user2["active"], True)

        # Positive tests ---------------------------------------------------------------------------
        self.assertTrue(UserManagementInterface.update_user_information(user_id2,
                                                                        user2["user_name"],
                                                                        user2["display_name"],
                                                                        "*****@*****.**",
                                                                        user2["active"]))

        user2 = UserManagementInterface.read_user_by_id(user_id2)

        self.assertEqual(user2["id"], user_id2)
        self.assertEqual(user2["user_name"], "test2")
        self.assertEqual(user2["display_name"], "Test 2")
        self.assertEqual(user2["email"], "*****@*****.**")
        self.assertEqual(user2["active"], True)
    def test_update_user_invalid_user_id(self):
        user_id2 = self.create_user_test2()
        self.assertIsNotNone(user_id2)

        user2 = UserManagementInterface.read_user_by_id(user_id2)

        self.assertEqual(user2["id"], user_id2)
        self.assertEqual(user2["user_name"], "test2")
        self.assertEqual(user2["display_name"], "Test 2")
        self.assertEqual(user2["email"], "*****@*****.**")
        self.assertEqual(user2["active"], True)

        # Positive tests ---------------------------------------------------------------------------
        # Try to update a user with a reference to a non-existing user ID
        self.assertFalse(
            UserManagementInterface.update_user_information(
                999, user2["user_name"], user2["display_name"], user2["email"],
                user2["active"]))
    def test_update_user_invalid_user_id(self):
        user_id2 = self.create_user_test2()
        self.assertIsNotNone(user_id2)

        user2 = UserManagementInterface.read_user_by_id(user_id2)

        self.assertEqual(user2["id"], user_id2)
        self.assertEqual(user2["user_name"], "test2")
        self.assertEqual(user2["display_name"], "Test 2")
        self.assertEqual(user2["email"], "*****@*****.**")
        self.assertEqual(user2["active"], True)

        # Positive tests ---------------------------------------------------------------------------
        # Try to update a user with a reference to a non-existing user ID
        self.assertFalse(UserManagementInterface.update_user_information(999,
                                                                         user2["user_name"],
                                                                         user2["display_name"],
                                                                         user2["email"],
                                                                         user2["active"]))