From b1c869bcec9c6a8c1f3a208e140d621a9d1f429a Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Tue, 16 Dec 2025 08:48:38 -0800 Subject: [PATCH 1/3] chore: Make dependabot builds run without secrets (box/box-codegen#904) --- .codegen.json | 2 +- .github/workflows/build.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.codegen.json b/.codegen.json index ae1d027ab..c96fa681e 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "de55410", "specHash": "1e0848d", "version": "10.2.0" } +{ "engineHash": "467757c", "specHash": "1e0848d", "version": "10.2.0" } diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2755672f5..68c075193 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,7 +30,7 @@ jobs: python -m pip install -e .[dev] python -m pip install tox-gh-actions - name: All Tests - if: startsWith(github.head_ref, 'codegen-release') + if: ${{ startsWith(github.head_ref, 'codegen-release') && github.actor != 'dependabot[bot]' }} env: JWT_CONFIG_BASE_64: ${{ secrets.JWT_CONFIG_BASE_64 }} ADMIN_USER_ID: ${{ secrets.ADMIN_USER_ID }} @@ -51,7 +51,7 @@ jobs: run: | tox - name: Smoke Tests - if: "!startsWith(github.head_ref, 'codegen-release')" + if: ${{ !startsWith(github.head_ref, 'codegen-release') && github.actor != 'dependabot[bot]' }} env: JWT_CONFIG_BASE_64: ${{ secrets.JWT_CONFIG_BASE_64 }} CLIENT_ID: ${{ secrets.CLIENT_ID }} From 89ecda4b01cd496e4749dc0504dc33e6c9b9b309 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Tue, 16 Dec 2025 15:48:56 -0800 Subject: [PATCH 2/3] chore: Update `.codegen.json` with commit hash of `codegen` and `openapi` spec [skip ci] --- .codegen.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.codegen.json b/.codegen.json index c96fa681e..53a11046a 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "467757c", "specHash": "1e0848d", "version": "10.2.0" } +{ "engineHash": "b029cfa", "specHash": "1e0848d", "version": "10.2.0" } From d08429a7e24515bc73b16344aeae105390270ff0 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Wed, 17 Dec 2025 02:35:15 -0800 Subject: [PATCH 3/3] test: Metadata Taxonomies integration tests (box/box-codegen#897) --- .codegen.json | 2 +- docs/metadata_taxonomies.md | 99 ++++++++++++++++++++--- test/metadata_taxonomies.py | 156 ++++++++++++++++++++++++++++++++++++ 3 files changed, 243 insertions(+), 14 deletions(-) create mode 100644 test/metadata_taxonomies.py diff --git a/.codegen.json b/.codegen.json index 53a11046a..371ed623a 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "b029cfa", "specHash": "1e0848d", "version": "10.2.0" } +{ "engineHash": "c370934", "specHash": "1e0848d", "version": "10.2.0" } diff --git a/docs/metadata_taxonomies.md b/docs/metadata_taxonomies.md index 9c03b697e..ec7bf6b61 100644 --- a/docs/metadata_taxonomies.md +++ b/docs/metadata_taxonomies.md @@ -26,7 +26,13 @@ This operation is performed by calling function `create_metadata_taxonomy`. See the endpoint docs at [API Reference](https://developer.box.com/reference/post-metadata-taxonomies/). -_Currently we don't have an example for calling `create_metadata_taxonomy` in integration tests_ + + +```python +client.metadata_taxonomies.create_metadata_taxonomy( + display_name, namespace, key=taxonomy_key +) +``` ### Arguments @@ -54,7 +60,11 @@ This operation is performed by calling function `get_metadata_taxonomies`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-metadata-taxonomies-id/). -_Currently we don't have an example for calling `get_metadata_taxonomies` in integration tests_ + + +```python +client.metadata_taxonomies.get_metadata_taxonomies(namespace) +``` ### Arguments @@ -83,7 +93,11 @@ This operation is performed by calling function `get_metadata_taxonomy_by_key`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-metadata-taxonomies-id-id/). -_Currently we don't have an example for calling `get_metadata_taxonomy_by_key` in integration tests_ + + +```python +client.metadata_taxonomies.get_metadata_taxonomy_by_key(namespace, taxonomy_key) +``` ### Arguments @@ -109,7 +123,13 @@ This operation is performed by calling function `update_metadata_taxonomy`. See the endpoint docs at [API Reference](https://developer.box.com/reference/patch-metadata-taxonomies-id-id/). -_Currently we don't have an example for calling `update_metadata_taxonomy` in integration tests_ + + +```python +client.metadata_taxonomies.update_metadata_taxonomy( + namespace, taxonomy_key, updated_display_name +) +``` ### Arguments @@ -138,7 +158,11 @@ This operation is performed by calling function `delete_metadata_taxonomy`. See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-metadata-taxonomies-id-id/). -_Currently we don't have an example for calling `delete_metadata_taxonomy` in integration tests_ + + +```python +client.metadata_taxonomies.delete_metadata_taxonomy(namespace, taxonomy_key) +``` ### Arguments @@ -164,7 +188,18 @@ This operation is performed by calling function `create_metadata_taxonomy_level` See the endpoint docs at [API Reference](https://developer.box.com/reference/post-metadata-taxonomies-id-id-levels/). -_Currently we don't have an example for calling `create_metadata_taxonomy_level` in integration tests_ + + +```python +client.metadata_taxonomies.create_metadata_taxonomy_level( + namespace, + taxonomy_key, + [ + MetadataTaxonomyLevel(display_name="Continent", description="Continent Level"), + MetadataTaxonomyLevel(display_name="Country", description="Country Level"), + ], +) +``` ### Arguments @@ -225,7 +260,13 @@ This operation is performed by calling function `add_metadata_taxonomy_level`. See the endpoint docs at [API Reference](https://developer.box.com/reference/post-metadata-taxonomies-id-id-levels:append/). -_Currently we don't have an example for calling `add_metadata_taxonomy_level` in integration tests_ + + +```python +client.metadata_taxonomies.add_metadata_taxonomy_level( + namespace, taxonomy_key, "Region", description="Region Description" +) +``` ### Arguments @@ -255,7 +296,11 @@ This operation is performed by calling function `delete_metadata_taxonomy_level` See the endpoint docs at [API Reference](https://developer.box.com/reference/post-metadata-taxonomies-id-id-levels:trim/). -_Currently we don't have an example for calling `delete_metadata_taxonomy_level` in integration tests_ + + +```python +client.metadata_taxonomies.delete_metadata_taxonomy_level(namespace, taxonomy_key) +``` ### Arguments @@ -283,7 +328,11 @@ This operation is performed by calling function `get_metadata_taxonomy_nodes`. See the endpoint docs at [API Reference](https://developer.box.com/reference/get-metadata-taxonomies-id-id-nodes/). -_Currently we don't have an example for calling `get_metadata_taxonomy_nodes` in integration tests_ + + +```python +client.metadata_taxonomies.get_metadata_taxonomy_nodes(namespace, taxonomy_key) +``` ### Arguments @@ -323,7 +372,13 @@ This operation is performed by calling function `create_metadata_taxonomy_node`. See the endpoint docs at [API Reference](https://developer.box.com/reference/post-metadata-taxonomies-id-id-nodes/). -_Currently we don't have an example for calling `create_metadata_taxonomy_node` in integration tests_ + + +```python +client.metadata_taxonomies.create_metadata_taxonomy_node( + namespace, taxonomy_key, "Europe", 1 +) +``` ### Arguments @@ -355,7 +410,13 @@ This operation is performed by calling function `get_metadata_taxonomy_node_by_i See the endpoint docs at [API Reference](https://developer.box.com/reference/get-metadata-taxonomies-id-id-nodes-id/). -_Currently we don't have an example for calling `get_metadata_taxonomy_node_by_id` in integration tests_ + + +```python +client.metadata_taxonomies.get_metadata_taxonomy_node_by_id( + namespace, taxonomy_key, country_node.id +) +``` ### Arguments @@ -383,7 +444,13 @@ This operation is performed by calling function `update_metadata_taxonomy_node`. See the endpoint docs at [API Reference](https://developer.box.com/reference/patch-metadata-taxonomies-id-id-nodes-id/). -_Currently we don't have an example for calling `update_metadata_taxonomy_node` in integration tests_ + + +```python +client.metadata_taxonomies.update_metadata_taxonomy_node( + namespace, taxonomy_key, country_node.id, display_name="Poland UPDATED" +) +``` ### Arguments @@ -415,7 +482,13 @@ This operation is performed by calling function `delete_metadata_taxonomy_node`. See the endpoint docs at [API Reference](https://developer.box.com/reference/delete-metadata-taxonomies-id-id-nodes-id/). -_Currently we don't have an example for calling `delete_metadata_taxonomy_node` in integration tests_ + + +```python +client.metadata_taxonomies.delete_metadata_taxonomy_node( + namespace, taxonomy_key, country_node.id +) +``` ### Arguments diff --git a/test/metadata_taxonomies.py b/test/metadata_taxonomies.py new file mode 100644 index 000000000..13613a9e9 --- /dev/null +++ b/test/metadata_taxonomies.py @@ -0,0 +1,156 @@ +import pytest + +from box_sdk_gen.client import BoxClient + +from box_sdk_gen.schemas.metadata_taxonomy import MetadataTaxonomy + +from box_sdk_gen.schemas.metadata_taxonomies import MetadataTaxonomies + +from box_sdk_gen.schemas.metadata_taxonomy_levels import MetadataTaxonomyLevels + +from box_sdk_gen.schemas.metadata_taxonomy_level import MetadataTaxonomyLevel + +from box_sdk_gen.schemas.metadata_taxonomy_node import MetadataTaxonomyNode + +from box_sdk_gen.schemas.metadata_taxonomy_nodes import MetadataTaxonomyNodes + +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 delay_in_seconds + +from test.commons import get_default_client + +client: BoxClient = get_default_client() + + +def testMetadataTaxonomiesCRUD(): + namespace: str = ''.join(['enterprise_', get_env_var('ENTERPRISE_ID')]) + uuid: str = get_uuid() + taxonomy_key: str = ''.join(['geography', uuid]) + display_name: str = ''.join(['Geography Taxonomy', uuid]) + created_taxonomy: MetadataTaxonomy = ( + client.metadata_taxonomies.create_metadata_taxonomy( + display_name, namespace, key=taxonomy_key + ) + ) + assert created_taxonomy.display_name == display_name + assert created_taxonomy.namespace == namespace + taxonomies: MetadataTaxonomies = client.metadata_taxonomies.get_metadata_taxonomies( + namespace + ) + assert len(taxonomies.entries) > 0 + assert taxonomies.entries[0].namespace == namespace + updated_display_name: str = ''.join(['Geography Taxonomy UPDATED', uuid]) + updated_taxonomy: MetadataTaxonomy = ( + client.metadata_taxonomies.update_metadata_taxonomy( + namespace, taxonomy_key, updated_display_name + ) + ) + assert updated_taxonomy.display_name == updated_display_name + assert updated_taxonomy.namespace == namespace + assert updated_taxonomy.id == created_taxonomy.id + get_taxonomy: MetadataTaxonomy = ( + client.metadata_taxonomies.get_metadata_taxonomy_by_key(namespace, taxonomy_key) + ) + assert get_taxonomy.display_name == updated_display_name + assert get_taxonomy.namespace == namespace + assert get_taxonomy.id == created_taxonomy.id + client.metadata_taxonomies.delete_metadata_taxonomy(namespace, taxonomy_key) + with pytest.raises(Exception): + client.metadata_taxonomies.get_metadata_taxonomy_by_key(namespace, taxonomy_key) + + +def testMetadataTaxonomiesNodes(): + namespace: str = ''.join(['enterprise_', get_env_var('ENTERPRISE_ID')]) + uuid: str = get_uuid() + taxonomy_key: str = ''.join(['geography', uuid]) + display_name: str = ''.join(['Geography Taxonomy', uuid]) + created_taxonomy: MetadataTaxonomy = ( + client.metadata_taxonomies.create_metadata_taxonomy( + display_name, namespace, key=taxonomy_key + ) + ) + assert created_taxonomy.display_name == display_name + assert created_taxonomy.namespace == namespace + taxonomy_levels: MetadataTaxonomyLevels = ( + client.metadata_taxonomies.create_metadata_taxonomy_level( + namespace, + taxonomy_key, + [ + MetadataTaxonomyLevel( + display_name='Continent', description='Continent Level' + ), + MetadataTaxonomyLevel( + display_name='Country', description='Country Level' + ), + ], + ) + ) + assert len(taxonomy_levels.entries) == 2 + assert taxonomy_levels.entries[0].display_name == 'Continent' + assert taxonomy_levels.entries[1].display_name == 'Country' + taxonomy_levels_after_addition: MetadataTaxonomyLevels = ( + client.metadata_taxonomies.add_metadata_taxonomy_level( + namespace, taxonomy_key, 'Region', description='Region Description' + ) + ) + assert len(taxonomy_levels_after_addition.entries) == 3 + assert taxonomy_levels_after_addition.entries[2].display_name == 'Region' + taxonomy_levels_after_deletion: MetadataTaxonomyLevels = ( + client.metadata_taxonomies.delete_metadata_taxonomy_level( + namespace, taxonomy_key + ) + ) + assert len(taxonomy_levels_after_deletion.entries) == 2 + assert taxonomy_levels_after_deletion.entries[0].display_name == 'Continent' + assert taxonomy_levels_after_deletion.entries[1].display_name == 'Country' + continent_node: MetadataTaxonomyNode = ( + client.metadata_taxonomies.create_metadata_taxonomy_node( + namespace, taxonomy_key, 'Europe', 1 + ) + ) + assert continent_node.display_name == 'Europe' + assert continent_node.level == 1 + country_node: MetadataTaxonomyNode = ( + client.metadata_taxonomies.create_metadata_taxonomy_node( + namespace, taxonomy_key, 'Poland', 2, parent_id=continent_node.id + ) + ) + assert country_node.display_name == 'Poland' + assert country_node.level == 2 + assert country_node.parent_id == continent_node.id + delay_in_seconds(5) + all_nodes: MetadataTaxonomyNodes = ( + client.metadata_taxonomies.get_metadata_taxonomy_nodes(namespace, taxonomy_key) + ) + assert len(all_nodes.entries) == 2 + updated_country_node: MetadataTaxonomyNode = ( + client.metadata_taxonomies.update_metadata_taxonomy_node( + namespace, taxonomy_key, country_node.id, display_name='Poland UPDATED' + ) + ) + assert updated_country_node.display_name == 'Poland UPDATED' + assert updated_country_node.level == 2 + assert updated_country_node.parent_id == country_node.parent_id + assert updated_country_node.id == country_node.id + get_country_node: MetadataTaxonomyNode = ( + client.metadata_taxonomies.get_metadata_taxonomy_node_by_id( + namespace, taxonomy_key, country_node.id + ) + ) + assert get_country_node.display_name == 'Poland UPDATED' + assert get_country_node.id == country_node.id + client.metadata_taxonomies.delete_metadata_taxonomy_node( + namespace, taxonomy_key, country_node.id + ) + client.metadata_taxonomies.delete_metadata_taxonomy_node( + namespace, taxonomy_key, continent_node.id + ) + delay_in_seconds(5) + all_nodes_after_deletion: MetadataTaxonomyNodes = ( + client.metadata_taxonomies.get_metadata_taxonomy_nodes(namespace, taxonomy_key) + ) + assert len(all_nodes_after_deletion.entries) == 0 + client.metadata_taxonomies.delete_metadata_taxonomy(namespace, taxonomy_key)