-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
generated with codegen at box/box-codegen@e7f791d and spec at box/box…
- Loading branch information
1 parent
3f24d37
commit 5140f17
Showing
3 changed files
with
82 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import pytest | ||
|
||
from box_sdk_gen.schemas import CollaborationAllowlistExemptTargets | ||
|
||
from box_sdk_gen.schemas import User | ||
|
||
from box_sdk_gen.schemas import CollaborationAllowlistExemptTarget | ||
|
||
from box_sdk_gen.managers.collaboration_allowlist_exempt_targets import ( | ||
CreateCollaborationWhitelistExemptTargetUserArg, | ||
) | ||
|
||
from box_sdk_gen.utils import decode_base_64 | ||
|
||
from box_sdk_gen.utils import get_env_var | ||
|
||
from box_sdk_gen.utils import get_uuid | ||
|
||
from box_sdk_gen.client import Client | ||
|
||
from box_sdk_gen.jwt_auth import JWTAuth | ||
|
||
from box_sdk_gen.jwt_auth import JWTConfig | ||
|
||
client: Client = Client( | ||
auth=JWTAuth( | ||
config=JWTConfig.from_config_json_string( | ||
decode_base_64(get_env_var('JWT_CONFIG_BASE_64')) | ||
) | ||
) | ||
) | ||
|
||
|
||
def collaborationAllowlistExemptTargets(): | ||
exempt_targets: CollaborationAllowlistExemptTargets = ( | ||
client.collaboration_allowlist_exempt_targets.get_collaboration_whitelist_exempt_targets() | ||
) | ||
assert len(exempt_targets.entries) >= 0 | ||
user: User = client.users.create_user( | ||
name=get_uuid(), | ||
login=''.join([get_uuid(), '@boxdemo.com']), | ||
is_platform_access_only=True, | ||
) | ||
new_exempt_target: CollaborationAllowlistExemptTarget = client.collaboration_allowlist_exempt_targets.create_collaboration_whitelist_exempt_target( | ||
user=CreateCollaborationWhitelistExemptTargetUserArg(id=user.id) | ||
) | ||
assert new_exempt_target.type == 'collaboration_whitelist_exempt_target' | ||
assert new_exempt_target.user.id == user.id | ||
exempt_target: CollaborationAllowlistExemptTarget = client.collaboration_allowlist_exempt_targets.get_collaboration_whitelist_exempt_target_by_id( | ||
collaboration_whitelist_exempt_target_id=new_exempt_target.id | ||
) | ||
assert exempt_target.id == new_exempt_target.id | ||
assert exempt_target.user.id == user.id | ||
client.collaboration_allowlist_exempt_targets.delete_collaboration_whitelist_exempt_target_by_id( | ||
collaboration_whitelist_exempt_target_id=exempt_target.id | ||
) | ||
with pytest.raises(Exception): | ||
client.collaboration_allowlist_exempt_targets.get_collaboration_whitelist_exempt_target_by_id( | ||
collaboration_whitelist_exempt_target_id=exempt_target.id | ||
) | ||
client.users.delete_user_by_id(user_id=user.id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters