Skip to content

Commit

Permalink
Fix coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
frankie567 committed Jul 12, 2024
1 parent 9a84e3e commit 86a239e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion httpx_oauth/clients/linkedin.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ async def refresh_token(self, refresh_token: str) -> OAuth2Token:
access_token = await client.refresh_token("REFRESH_TOKEN")
```
"""
return await super().refresh_token(refresh_token)
return await super().refresh_token(refresh_token) # pragma: no cover

async def get_id_email(self, token: str) -> Tuple[str, Optional[str]]:
async with self.get_httpx_client() as client:
Expand Down
15 changes: 14 additions & 1 deletion tests/test_clients_openid.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest
import respx
from httpx import Response
from httpx import HTTPError, Response

from httpx_oauth.clients.openid import OpenID, OpenIDConfigurationError
from httpx_oauth.exceptions import GetIdEmailError
Expand Down Expand Up @@ -65,6 +65,19 @@ def test_openid_configuration_error():
)


@respx.mock
def test_openid_configuration_http_error():
respx.get(
re.compile("https://example.fief.dev/.well-known/openid-configuration")
).mock(side_effect=HTTPError("ERROR"))
with pytest.raises(OpenIDConfigurationError):
OpenID(
"CLIENT_ID",
"CLIENT_SECRET",
"https://example.fief.dev/.well-known/openid-configuration",
)


@respx.mock
def test_openid(client: OpenID):
assert client.authorize_endpoint == "https://example.fief.dev/authorize"
Expand Down

0 comments on commit 86a239e

Please sign in to comment.