Skip to content

Commit cdbcb62

Browse files
test: Add test for device pinners (box/box-codegen#443) (#71)
1 parent 36953da commit cdbcb62

File tree

3 files changed

+51
-4
lines changed

3 files changed

+51
-4
lines changed

.codegen.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "engineHash": "9f6df0d", "specHash": "b2f7568", "version": "0.5.1" }
1+
{ "engineHash": "9836a44", "specHash": "b2f7568", "version": "0.5.1" }

docs/device_pinners.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ This operation is performed by calling function `get_device_pinner_by_id`.
1313
See the endpoint docs at
1414
[API Reference](https://developer.box.com/reference/get-device-pinners-id/).
1515

16-
_Currently we don't have an example for calling `get_device_pinner_by_id` in integration tests_
16+
<!-- sample get_device_pinners_id -->
17+
18+
```python
19+
client.device_pinners.get_device_pinner_by_id(device_pinner_id=device_pinner_id)
20+
```
1721

1822
### Arguments
1923

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

40-
_Currently we don't have an example for calling `delete_device_pinner_by_id` in integration tests_
44+
<!-- sample delete_device_pinners_id -->
45+
46+
```python
47+
client.device_pinners.delete_device_pinner_by_id(device_pinner_id=device_pinner_id)
48+
```
4149

4250
### Arguments
4351

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

67-
_Currently we don't have an example for calling `get_enterprise_device_pinners` in integration tests_
75+
<!-- sample get_enterprises_id_device_pinners -->
76+
77+
```python
78+
client.device_pinners.get_enterprise_device_pinners(enterprise_id=enterprise_id, direction=GetEnterpriseDevicePinnersDirection.DESC.value)
79+
```
6880

6981
### Arguments
7082

test/device_pinners.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import pytest
2+
3+
from box_sdk_gen.client import BoxClient
4+
5+
from box_sdk_gen.schemas import DevicePinners
6+
7+
from box_sdk_gen.managers.device_pinners import GetEnterpriseDevicePinnersDirection
8+
9+
from test.commons import get_default_client
10+
11+
from box_sdk_gen.internal.utils import get_env_var
12+
13+
client: BoxClient = get_default_client()
14+
15+
16+
def testDevicePinners():
17+
enterprise_id: str = get_env_var('ENTERPRISE_ID')
18+
device_pinners: DevicePinners = client.device_pinners.get_enterprise_device_pinners(
19+
enterprise_id=enterprise_id
20+
)
21+
assert len(device_pinners.entries) >= 0
22+
device_pinners_in_desc_direction: DevicePinners = (
23+
client.device_pinners.get_enterprise_device_pinners(
24+
enterprise_id=enterprise_id,
25+
direction=GetEnterpriseDevicePinnersDirection.DESC.value,
26+
)
27+
)
28+
assert len(device_pinners_in_desc_direction.entries) >= 0
29+
device_pinner_id: str = '123456'
30+
with pytest.raises(Exception):
31+
client.device_pinners.get_device_pinner_by_id(device_pinner_id=device_pinner_id)
32+
with pytest.raises(Exception):
33+
client.device_pinners.delete_device_pinner_by_id(
34+
device_pinner_id=device_pinner_id
35+
)

0 commit comments

Comments
 (0)