Skip to content

Commit

Permalink
test: Create preflight file upload check test (box/box-codegen#653) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
box-sdk-build authored Jan 31, 2025
1 parent 7c73cea commit e6af34d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "engineHash": "a74691d", "specHash": "1fdcbef", "version": "1.10.0" }
{ "engineHash": "1965ba0", "specHash": "1fdcbef", "version": "1.10.0" }
8 changes: 7 additions & 1 deletion docs/uploads.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@ This operation is performed by calling function `preflight_file_upload_check`.
See the endpoint docs at
[API Reference](https://developer.box.com/reference/options-files-content/).

_Currently we don't have an example for calling `preflight_file_upload_check` in integration tests_
<!-- sample options_files_content -->

```python
client.uploads.preflight_file_upload_check(
name=new_file_name, size=1024 * 1024, parent=PreflightFileUploadCheckParent(id="0")
)
```

### Arguments

Expand Down
3 changes: 3 additions & 0 deletions test/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@

from box_sdk_gen.internal.utils import date_time_from_string

from box_sdk_gen.internal.utils import delay_in_seconds

from test.commons import get_default_client

from box_sdk_gen.schemas.metadata_field_filter_date_range import (
Expand Down Expand Up @@ -128,6 +130,7 @@ def testCreateMetaDataQueryExecuteRead():
)
assert metadata.template == template_key
assert metadata.scope == template.scope
delay_in_seconds(5)
search_from: str = ''.join([template.scope, '.', template.template_key])
query: MetadataQueryResults = client.search.search_by_metadata_query(
search_from,
Expand Down
14 changes: 14 additions & 0 deletions test/uploads.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

from box_sdk_gen.managers.uploads import UploadFileVersionAttributes

from box_sdk_gen.schemas.upload_url import UploadUrl

from box_sdk_gen.managers.uploads import PreflightFileUploadCheckParent

from box_sdk_gen.internal.utils import get_uuid

from box_sdk_gen.internal.utils import generate_byte_stream
Expand Down Expand Up @@ -42,3 +46,13 @@ def testUploadFileAndFileVersion():
new_file_version: FileFull = uploaded_files_version.entries[0]
assert new_file_version.name == new_file_version_name
client.files.delete_file_by_id(new_file_version.id)


def testPreflightCheck():
new_file_name: str = get_uuid()
preflight_check_result: UploadUrl = client.uploads.preflight_file_upload_check(
name=new_file_name,
size=1024 * 1024,
parent=PreflightFileUploadCheckParent(id='0'),
)
assert not preflight_check_result.upload_url == ''

0 comments on commit e6af34d

Please sign in to comment.