Skip to content

Commit

Permalink
feat: use getDiscriminatorsForUnion in generic serialization (box/box…
Browse files Browse the repository at this point in the history
  • Loading branch information
box-sdk-build authored Mar 19, 2024
1 parent ec8136e commit 2bb15a8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "engineHash": "bd1adff", "specHash": "b2f7568", "version": "0.6.1" }
{ "engineHash": "183c130", "specHash": "b2f7568", "version": "0.6.1" }
29 changes: 18 additions & 11 deletions test/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@

from test.commons import get_default_client

from box_sdk_gen.schemas import EventSource

from box_sdk_gen.schemas import File

from box_sdk_gen.schemas import Folder

from box_sdk_gen.schemas import User

client: BoxClient = get_default_client()


Expand All @@ -35,12 +43,12 @@ def testEventUpload():
assert len(events.entries) > 0
event: Event = events.entries[0]
assert to_string(event.event_type) == 'UPLOAD'
source: EventSource = event.source
assert (
to_string(event.source.item_type) == 'file'
or to_string(event.source.item_type) == 'folder'
to_string(source.item_type) == 'file' or to_string(source.item_type) == 'folder'
)
assert not event.source.item_id == ''
assert not event.source.item_name == ''
assert not source.item_id == ''
assert not source.item_name == ''


def testEventDeleteUser():
Expand All @@ -51,8 +59,9 @@ def testEventDeleteUser():
assert len(events.entries) > 0
event: Event = events.entries[0]
assert to_string(event.event_type) == 'DELETE_USER'
assert to_string(event.source.type) == 'user'
assert not event.source.id == ''
source: User = event.source
assert to_string(source.type) == 'user'
assert not source.id == ''


def testEventSourceFileOrFolder():
Expand All @@ -61,11 +70,9 @@ def testEventSourceFileOrFolder():
)
assert len(events.entries) > 0
event: Event = events.entries[0]
assert (
to_string(event.source.type) == 'file'
or to_string(event.source.type) == 'folder'
)
assert not event.source.id == ''
source: File = event.source
assert to_string(source.type) == 'file' or to_string(source.type) == 'folder'
assert not source.id == ''


def testGetEventsWithLongPolling():
Expand Down

0 comments on commit 2bb15a8

Please sign in to comment.