Skip to content

Commit

Permalink
test: Add test for device pinners (box/box-codegen#443) (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
box-sdk-build authored Mar 6, 2024
1 parent 36953da commit cdbcb62
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "engineHash": "9f6df0d", "specHash": "b2f7568", "version": "0.5.1" }
{ "engineHash": "9836a44", "specHash": "b2f7568", "version": "0.5.1" }
18 changes: 15 additions & 3 deletions docs/device_pinners.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ This operation is performed by calling function `get_device_pinner_by_id`.
See the endpoint docs at
[API Reference](https://developer.box.com/reference/get-device-pinners-id/).

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

```python
client.device_pinners.get_device_pinner_by_id(device_pinner_id=device_pinner_id)
```

### Arguments

Expand All @@ -37,7 +41,11 @@ This operation is performed by calling function `delete_device_pinner_by_id`.
See the endpoint docs at
[API Reference](https://developer.box.com/reference/delete-device-pinners-id/).

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

```python
client.device_pinners.delete_device_pinner_by_id(device_pinner_id=device_pinner_id)
```

### Arguments

Expand All @@ -64,7 +72,11 @@ This operation is performed by calling function `get_enterprise_device_pinners`.
See the endpoint docs at
[API Reference](https://developer.box.com/reference/get-enterprises-id-device-pinners/).

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

```python
client.device_pinners.get_enterprise_device_pinners(enterprise_id=enterprise_id, direction=GetEnterpriseDevicePinnersDirection.DESC.value)
```

### Arguments

Expand Down
35 changes: 35 additions & 0 deletions test/device_pinners.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import pytest

from box_sdk_gen.client import BoxClient

from box_sdk_gen.schemas import DevicePinners

from box_sdk_gen.managers.device_pinners import GetEnterpriseDevicePinnersDirection

from test.commons import get_default_client

from box_sdk_gen.internal.utils import get_env_var

client: BoxClient = get_default_client()


def testDevicePinners():
enterprise_id: str = get_env_var('ENTERPRISE_ID')
device_pinners: DevicePinners = client.device_pinners.get_enterprise_device_pinners(
enterprise_id=enterprise_id
)
assert len(device_pinners.entries) >= 0
device_pinners_in_desc_direction: DevicePinners = (
client.device_pinners.get_enterprise_device_pinners(
enterprise_id=enterprise_id,
direction=GetEnterpriseDevicePinnersDirection.DESC.value,
)
)
assert len(device_pinners_in_desc_direction.entries) >= 0
device_pinner_id: str = '123456'
with pytest.raises(Exception):
client.device_pinners.get_device_pinner_by_id(device_pinner_id=device_pinner_id)
with pytest.raises(Exception):
client.device_pinners.delete_device_pinner_by_id(
device_pinner_id=device_pinner_id
)

0 comments on commit cdbcb62

Please sign in to comment.