Enhance OAuth client to support scope options and update related tests
This commit is contained in:
parent
1a9f924764
commit
bebf99d826
5 changed files with 80 additions and 15 deletions
|
|
@ -30,8 +30,19 @@ from ebay_client.notification.client import NotificationClient
|
|||
|
||||
|
||||
class DummyOAuthClient:
|
||||
def get_valid_token(self, *, scopes: list[str] | None = None) -> OAuthToken:
|
||||
return OAuthToken(access_token="test-token", scope=" ".join(scopes or []))
|
||||
def get_valid_token(
|
||||
self,
|
||||
*,
|
||||
scopes: list[str] | None = None,
|
||||
scope_options: list[list[str]] | None = None,
|
||||
) -> OAuthToken:
|
||||
if scopes:
|
||||
resolved_scopes = scopes
|
||||
elif scope_options:
|
||||
resolved_scopes = scope_options[0]
|
||||
else:
|
||||
resolved_scopes = []
|
||||
return OAuthToken(access_token="test-token", scope=" ".join(resolved_scopes))
|
||||
|
||||
|
||||
def build_transport() -> ApiTransport:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue