def test_invalid_api_key(client: R2RClient):
    """Test behavior with invalid API key."""
    api_client = R2RClient(client.base_url)
    api_client.set_api_key("invalid.api.key")

    with pytest.raises(R2RException) as exc_info:
        api_client.users.me()
    assert exc_info.value.status_code == 401, (
        "Expected 401 for invalid API key")
Test behavior with invalid API key.
py/tests/integration/test_users.py