diff --git a/.codegen.json b/.codegen.json index a013a692..c4b22db0 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "18868e7", "specHash": "f899bf6", "version": "10.7.0" } +{ "engineHash": "c571efa", "specHash": "f899bf6", "version": "10.7.0" } diff --git a/.github/workflows/build-and-test-daily.yml b/.github/workflows/build-and-test-daily.yml index 7ed85886..c8dbdec2 100644 --- a/.github/workflows/build-and-test-daily.yml +++ b/.github/workflows/build-and-test-daily.yml @@ -49,6 +49,7 @@ jobs: SLACK_AUTOMATION_USER_ID: ${{ secrets.SLACK_AUTOMATION_USER_ID }} SLACK_ORG_ID: ${{ secrets.SLACK_ORG_ID }} SLACK_PARTNER_ITEM_ID: ${{ secrets.SLACK_PARTNER_ITEM_ID }} + AUTOMATE_WORKFLOW_FOLDER_ID: ${{ secrets.AUTOMATE_WORKFLOW_FOLDER_ID }} run: | tox coverage: @@ -90,6 +91,7 @@ jobs: SLACK_AUTOMATION_USER_ID: ${{ secrets.SLACK_AUTOMATION_USER_ID }} SLACK_ORG_ID: ${{ secrets.SLACK_ORG_ID }} SLACK_PARTNER_ITEM_ID: ${{ secrets.SLACK_PARTNER_ITEM_ID }} + AUTOMATE_WORKFLOW_FOLDER_ID: ${{ secrets.AUTOMATE_WORKFLOW_FOLDER_ID }} notify: name: Send Slack Notification runs-on: ubuntu-latest diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 68c07519..edc7f12e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -48,6 +48,7 @@ jobs: SLACK_AUTOMATION_USER_ID: ${{ secrets.SLACK_AUTOMATION_USER_ID }} SLACK_ORG_ID: ${{ secrets.SLACK_ORG_ID }} SLACK_PARTNER_ITEM_ID: ${{ secrets.SLACK_PARTNER_ITEM_ID }} + AUTOMATE_WORKFLOW_FOLDER_ID: ${{ secrets.AUTOMATE_WORKFLOW_FOLDER_ID }} run: | tox - name: Smoke Tests diff --git a/docs/automate_workflows.md b/docs/automate_workflows.md index 2931823d..c857811e 100644 --- a/docs/automate_workflows.md +++ b/docs/automate_workflows.md @@ -13,7 +13,11 @@ This operation is performed by calling function `get_automate_workflows_v2026_r0 See the endpoint docs at [API Reference](https://developer.box.com/reference/v2026.0/get-automate-workflows/). -_Currently we don't have an example for calling `get_automate_workflows_v2026_r0` in integration tests_ + + +```python +admin_client.automate_workflows.get_automate_workflows_v2026_r0(workflow_folder_id) +``` ### Arguments @@ -43,7 +47,13 @@ This operation is performed by calling function `create_automate_workflow_start_ See the endpoint docs at [API Reference](https://developer.box.com/reference/v2026.0/post-automate-workflows-id-start/). -_Currently we don't have an example for calling `create_automate_workflow_start_v2026_r0` in integration tests_ + + +```python +admin_client.automate_workflows.create_automate_workflow_start_v2026_r0( + workflow_action.workflow.id, workflow_action.id, [workflow_file_id] +) +``` ### Arguments diff --git a/test/automate_workflows.py b/test/automate_workflows.py new file mode 100644 index 00000000..93c1c6e1 --- /dev/null +++ b/test/automate_workflows.py @@ -0,0 +1,60 @@ +from box_sdk_gen.internal.utils import to_string + +from box_sdk_gen.client import BoxClient + +from box_sdk_gen.schemas.files import Files + +from box_sdk_gen.managers.uploads import UploadFileAttributes + +from box_sdk_gen.managers.uploads import UploadFileAttributesParentField + +from box_sdk_gen.schemas.file_full import FileFull + +from box_sdk_gen.schemas.v2026_r0.automate_workflows_v2026_r0 import ( + AutomateWorkflowsV2026R0, +) + +from box_sdk_gen.schemas.v2026_r0.automate_workflow_action_v2026_r0 import ( + AutomateWorkflowActionV2026R0, +) + +from box_sdk_gen.internal.utils import get_uuid + +from box_sdk_gen.internal.utils import get_env_var + +from box_sdk_gen.internal.utils import generate_byte_stream + +from test.commons import get_default_client + +from test.commons import get_default_client_with_user_subject + +client: BoxClient = get_default_client() + + +def testAutomateWorkflows(): + admin_client: BoxClient = get_default_client_with_user_subject( + get_env_var('USER_ID') + ) + workflow_folder_id: str = get_env_var('AUTOMATE_WORKFLOW_FOLDER_ID') + uploaded_files: Files = admin_client.uploads.upload_file( + UploadFileAttributes( + name=get_uuid(), + parent=UploadFileAttributesParentField(id=workflow_folder_id), + ), + generate_byte_stream(1024 * 1024), + ) + file: FileFull = uploaded_files.entries[0] + workflow_file_id: str = file.id + automate_workflows: AutomateWorkflowsV2026R0 = ( + admin_client.automate_workflows.get_automate_workflows_v2026_r0( + workflow_folder_id + ) + ) + assert len(automate_workflows.entries) == 1 + workflow_action: AutomateWorkflowActionV2026R0 = automate_workflows.entries[0] + assert to_string(workflow_action.type) == 'workflow_action' + assert to_string(workflow_action.action_type) == 'run_workflow' + assert to_string(workflow_action.workflow.type) == 'workflow' + admin_client.automate_workflows.create_automate_workflow_start_v2026_r0( + workflow_action.workflow.id, workflow_action.id, [workflow_file_id] + ) diff --git a/tox.ini b/tox.ini index 6e05d509..c4b5612d 100644 --- a/tox.ini +++ b/tox.ini @@ -22,7 +22,7 @@ commands = pytest -n 5 {posargs} --disable-pytest-warnings --reruns 2 deps = -rrequirements-test.txt allowlist_externals = pytest -passenv = JWT_CONFIG_BASE_64,ADMIN_USER_ID,CLIENT_ID,CLIENT_SECRET,USER_ID,ENTERPRISE_ID,BOX_FILE_REQUEST_ID,BOX_EXTERNAL_USER_EMAIL,BOX_EXTERNAL_USER_ID,WORKFLOW_FOLDER_ID,APP_ITEM_ASSOCIATION_FILE_ID,APP_ITEM_ASSOCIATION_FOLDER_ID,APP_ITEM_SHARED_LINK,SLACK_AUTOMATION_USER_ID,SLACK_ORG_ID,SLACK_PARTNER_ITEM_ID +passenv = JWT_CONFIG_BASE_64,ADMIN_USER_ID,CLIENT_ID,CLIENT_SECRET,USER_ID,ENTERPRISE_ID,BOX_FILE_REQUEST_ID,BOX_EXTERNAL_USER_EMAIL,BOX_EXTERNAL_USER_ID,WORKFLOW_FOLDER_ID,APP_ITEM_ASSOCIATION_FILE_ID,APP_ITEM_ASSOCIATION_FOLDER_ID,APP_ITEM_SHARED_LINK,SLACK_AUTOMATION_USER_ID,SLACK_ORG_ID,SLACK_PARTNER_ITEM_ID,AUTOMATE_WORKFLOW_FOLDER_ID [testenv:pycodestyle] commands = @@ -47,7 +47,7 @@ commands = deps = coverage -rrequirements-test.txt -passenv = JWT_CONFIG_BASE_64,ADMIN_USER_ID,CLIENT_ID,CLIENT_SECRET,USER_ID,ENTERPRISE_ID,BOX_FILE_REQUEST_ID,BOX_EXTERNAL_USER_EMAIL,BOX_EXTERNAL_USER_ID,WORKFLOW_FOLDER_ID,APP_ITEM_ASSOCIATION_FILE_ID,APP_ITEM_ASSOCIATION_FOLDER_ID,APP_ITEM_SHARED_LINK,SLACK_AUTOMATION_USER_ID,SLACK_ORG_ID,SLACK_PARTNER_ITEM_ID +passenv = JWT_CONFIG_BASE_64,ADMIN_USER_ID,CLIENT_ID,CLIENT_SECRET,USER_ID,ENTERPRISE_ID,BOX_FILE_REQUEST_ID,BOX_EXTERNAL_USER_EMAIL,BOX_EXTERNAL_USER_ID,WORKFLOW_FOLDER_ID,APP_ITEM_ASSOCIATION_FILE_ID,APP_ITEM_ASSOCIATION_FOLDER_ID,APP_ITEM_SHARED_LINK,SLACK_AUTOMATION_USER_ID,SLACK_ORG_ID,SLACK_PARTNER_ITEM_ID,AUTOMATE_WORKFLOW_FOLDER_ID [testenv:py311-build] description = Build the source and binary wheel packages for distribution.