def mock_response_token_401(monkeypatch):
    """Creating of mock_get method from the class, and monkeypatch application.

    It will return a 401 status code, emulating an invalid credentials error when using tokens to log in.
    Iterable structure to be able to pass the first 200 status code check
    """

    def mock_get(*args, **kwargs):
        if kwargs["url"] == "fake_url/api/me":
            raise UnauthorizedApiError()
        elif kwargs["url"] == "fake_url/api/docs/spec.json":
            return UserModel(
                id=uuid4(),
                username="mock_username",
                first_name="mock_first_name",
                role="admin",
                api_key="mock_api_key",
                workspaces=["mock_workspace"],
                inserted_at=datetime.datetime.now(),
                updated_at=datetime.datetime.now(),
            )

    monkeypatch.setattr(users_api, "whoami", mock_get)
Creating of mock_get method from the class, and monkeypatch application.

    It will return a 401 status code, emulating an invalid credentials error when using tokens to log in.
    Iterable structure to be able to pass the first 200 status code check
    
argilla-v1/tests/integration/client/test_api.py