Skip to content

Commit 6c23887

Browse files
test: remove hub tests temporarily (box/box-codegen#812) (#975)
* test: ExternalUsers API integration tests (box/box-codegen#799) * chore: Update `.codegen.json` with commit hash of `codegen` and `openapi` spec [skip ci] * chore: Update `.codegen.json` with commit hash of `codegen` and `openapi` spec [skip ci] * chore: Update `.codegen.json` with commit hash of `codegen` and `openapi` spec [skip ci] * test: remove hub tests temporarily (box/box-codegen#812)
1 parent 1266903 commit 6c23887

File tree

9 files changed

+70
-264
lines changed

9 files changed

+70
-264
lines changed

.codegen.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "engineHash": "3ba449c", "specHash": "ec8720b", "version": "0.1.0" }
1+
{ "engineHash": "dd00f3f", "specHash": "ec8720b", "version": "0.1.0" }

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ jobs:
3939
ENTERPRISE_ID: ${{ secrets.ENTERPRISE_ID }}
4040
BOX_FILE_REQUEST_ID: ${{ secrets.BOX_FILE_REQUEST_ID }}
4141
BOX_EXTERNAL_USER_EMAIL: ${{ secrets.BOX_EXTERNAL_USER_EMAIL }}
42+
BOX_EXTERNAL_USER_ID: ${{ secrets.BOX_EXTERNAL_USER_ID }}
4243
APP_ITEM_ASSOCIATION_FILE_ID: ${{ secrets.APP_ITEM_ASSOCIATION_FILE_ID }}
4344
APP_ITEM_ASSOCIATION_FOLDER_ID: ${{ secrets.APP_ITEM_ASSOCIATION_FOLDER_ID }}
4445
WORKFLOW_FOLDER_ID: ${{ secrets.WORKFLOW_FOLDER_ID }}
@@ -78,6 +79,7 @@ jobs:
7879
ENTERPRISE_ID: ${{ secrets.ENTERPRISE_ID }}
7980
BOX_FILE_REQUEST_ID: ${{ secrets.BOX_FILE_REQUEST_ID }}
8081
BOX_EXTERNAL_USER_EMAIL: ${{ secrets.BOX_EXTERNAL_USER_EMAIL }}
82+
BOX_EXTERNAL_USER_ID: ${{ secrets.BOX_EXTERNAL_USER_ID }}
8183
WORKFLOW_FOLDER_ID: ${{ secrets.WORKFLOW_FOLDER_ID }}
8284
APP_ITEM_ASSOCIATION_FILE_ID: ${{ secrets.APP_ITEM_ASSOCIATION_FILE_ID }}
8385
APP_ITEM_ASSOCIATION_FOLDER_ID: ${{ secrets.APP_ITEM_ASSOCIATION_FOLDER_ID }}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ Now select `Authorization` and submit application to be reviewed by account admi
116116
download your app configuration settings as JSON.
117117
2. Encode configuration file to Base64, e.g. using command: `base64 -i path_to_json_file`
118118
3. Set environment variable: `JWT_CONFIG_BASE_64` with base64 encoded jwt configuration file
119-
4. Set environment variable: `BOX_FILE_REQUEST_ID` with ID of file request already created in the user account, `BOX_EXTERNAL_USER_EMAIL` with email of free external user which not belongs to any enterprise.
119+
4. Set environment variable: `BOX_FILE_REQUEST_ID` with ID of file request already created in the user account, `BOX_EXTERNAL_USER_EMAIL` with email of free external user which not belongs to any enterprise and `BOX_EXTERNAL_USER_ID` with its ID.
120120
5. Set environment variable: `WORKFLOW_FOLDER_ID` with the ID of the Relay workflow that deletes the file that triggered the workflow. The workflow should have a manual start to be able to start it from the API.
121121
6. Set environment variable: `APP_ITEM_ASSOCIATION_FILE_ID` to the ID of the file with associated app item and `APP_ITEM_ASSOCIATION_FOLDER_ID` to the ID of the folder with associated app item.
122122
7. Set environment variable: `APP_ITEM_SHARED_LINK` to the shared link associated with app item.

docs/external_users.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@ This operation is performed by calling function `submit_job_to_delete_external_u
1212
See the endpoint docs at
1313
[API Reference](https://developer.box.com/reference/v2025.0/post-external-users-submit-delete-job/).
1414

15-
_Currently we don't have an example for calling `submit_job_to_delete_external_users_v2025_r0` in integration tests_
15+
<!-- sample post_external_users_submit_delete_job_v2025.0 -->
16+
17+
```python
18+
client.external_users.submit_job_to_delete_external_users_v2025_r0(
19+
[UserReferenceV2025R0(id=get_env_var("BOX_EXTERNAL_USER_ID"))]
20+
)
21+
```
1622

1723
### Arguments
1824

test/external_users.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
from box_sdk_gen.client import BoxClient
2+
3+
from box_sdk_gen.schemas.file_full import FileFull
4+
5+
from box_sdk_gen.schemas.collaboration import Collaboration
6+
7+
from box_sdk_gen.managers.user_collaborations import CreateCollaborationItem
8+
9+
from box_sdk_gen.managers.user_collaborations import CreateCollaborationItemTypeField
10+
11+
from box_sdk_gen.managers.user_collaborations import CreateCollaborationAccessibleBy
12+
13+
from box_sdk_gen.managers.user_collaborations import (
14+
CreateCollaborationAccessibleByTypeField,
15+
)
16+
17+
from box_sdk_gen.managers.user_collaborations import CreateCollaborationRole
18+
19+
from box_sdk_gen.schemas.v2025_r0.external_users_submit_delete_job_response_v2025_r0 import (
20+
ExternalUsersSubmitDeleteJobResponseV2025R0,
21+
)
22+
23+
from box_sdk_gen.schemas.v2025_r0.user_reference_v2025_r0 import UserReferenceV2025R0
24+
25+
from test.commons import get_default_client_with_user_subject
26+
27+
from test.commons import upload_new_file
28+
29+
from box_sdk_gen.internal.utils import get_env_var
30+
31+
from box_sdk_gen.internal.utils import get_uuid
32+
33+
client: BoxClient = get_default_client_with_user_subject(get_env_var('USER_ID'))
34+
35+
36+
def testSubmitJobToDeleteExternalUsers():
37+
file: FileFull = upload_new_file()
38+
file_collaboration: Collaboration = client.user_collaborations.create_collaboration(
39+
CreateCollaborationItem(type=CreateCollaborationItemTypeField.FILE, id=file.id),
40+
CreateCollaborationAccessibleBy(
41+
type=CreateCollaborationAccessibleByTypeField.USER,
42+
id=get_env_var('BOX_EXTERNAL_USER_ID'),
43+
),
44+
CreateCollaborationRole.EDITOR,
45+
)
46+
external_users_job_delete_response: ExternalUsersSubmitDeleteJobResponseV2025R0 = (
47+
client.external_users.submit_job_to_delete_external_users_v2025_r0(
48+
[UserReferenceV2025R0(id=get_env_var('BOX_EXTERNAL_USER_ID'))]
49+
)
50+
)
51+
assert len(external_users_job_delete_response.entries) == 1
52+
assert external_users_job_delete_response.entries[0].status == 202
53+
client.files.delete_file_by_id(file.id)

test/hub_collaborations.py

Lines changed: 0 additions & 88 deletions
This file was deleted.

test/hub_items.py

Lines changed: 0 additions & 93 deletions
This file was deleted.

test/hubs.py

Lines changed: 0 additions & 74 deletions
This file was deleted.

tox.ini

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,32 @@ commands =
2222
pytest {posargs} --disable-pytest-warnings --reruns 2
2323
deps = -rrequirements-test.txt
2424
allowlist_externals = pytest
25-
passenv = JWT_CONFIG_BASE_64,ADMIN_USER_ID,CLIENT_ID,CLIENT_SECRET,USER_ID,ENTERPRISE_ID,BOX_FILE_REQUEST_ID,BOX_EXTERNAL_USER_EMAIL,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
25+
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
2626

2727
[testenv:pycodestyle]
28-
commands =
28+
commands =
2929
pycodestyle --ignore=E501,W292 box_sdk_gen setup.py
3030
pycodestyle --ignore=E501,W292 test
31-
deps =
31+
deps =
3232
pycodestyle
3333

3434
[testenv:pylint]
3535
commands =
3636
pylint --rcfile=.pylintrc box_sdk_gen setup.py
3737
# pylint:disable W0621(redefined-outer-name) - Using py.test fixtures always breaks this rule.
3838
pylint --rcfile=.pylintrc test -d W0621 --ignore=mock_box
39-
deps =
39+
deps =
4040
pylint
4141
-rrequirements-test.txt
4242

4343
[testenv:coverage]
4444
basepython = python3.11
4545
commands =
4646
py.test --reruns 2 --cov box_sdk_gen --cov-report term-missing test/
47-
deps =
47+
deps =
4848
coverage
4949
-rrequirements-test.txt
50-
passenv = JWT_CONFIG_BASE_64,ADMIN_USER_ID,CLIENT_ID,CLIENT_SECRET,USER_ID,ENTERPRISE_ID,BOX_FILE_REQUEST_ID,BOX_EXTERNAL_USER_EMAIL,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
50+
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
5151

5252
[testenv:py311-build]
5353
description = Build the source and binary wheel packages for distribution.

0 commit comments

Comments
 (0)