Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Custom base URLs unit test (box/box-codegen#452) #101

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "engineHash": "3970588", "specHash": "d50ab5f", "version": "0.6.2" }
{ "engineHash": "0d4bf53", "specHash": "d50ab5f", "version": "0.6.2" }
15 changes: 15 additions & 0 deletions test/client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from box_sdk_gen.internal.utils import to_string

import pytest

from box_sdk_gen.client import BoxClient

from box_sdk_gen.schemas import UserFull
Expand All @@ -12,6 +14,8 @@

from box_sdk_gen.networking.fetch import FetchResponse

from box_sdk_gen.networking.base_urls import BaseUrls

client: BoxClient = get_default_client()


Expand Down Expand Up @@ -47,3 +51,14 @@ def testWithExtraHeaders():
app_user: UserFull = as_user_client.users.get_user_me()
assert to_string(app_user.name) == user_name
client.users.delete_user_by_id(created_user.id)


def testWithCustomBaseUrls():
new_base_urls: BaseUrls = BaseUrls(
base_url='https://box.com/',
upload_url='https://box.com/',
oauth_2_url='https://box.com/',
)
custom_base_client: BoxClient = client.with_custom_base_urls(new_base_urls)
with pytest.raises(Exception):
custom_base_client.users.get_user_me()
Loading