Skip to content

Commit

Permalink
test: Custom base URLs unit test (box/box-codegen#452) (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
box-sdk-build authored Mar 26, 2024
1 parent 7d4ec90 commit 63070ae
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
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()

0 comments on commit 63070ae

Please sign in to comment.