Skip to content

Commit b828b15

Browse files
vaibhavatlanAryamanz29
authored andcommitted
Added more integration tests
1 parent 02cde60 commit b828b15

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

pyatlan/client/asset.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,6 +1015,7 @@ def remove_atlan_tag(
10151015
:param asset_type: type of asset to which to add the Atlan tags
10161016
:param qualified_name: qualified_name of the asset to which to add the Atlan tags
10171017
:param atlan_tag_name: human-readable name of the Atlan tag to remove from the asset
1018+
:returns: the asset that was updated (note that it will NOT contain details of the deleted Atlan tag)
10181019
:raises AtlanError: on any API communication issue
10191020
"""
10201021
from pyatlan.client.atlan import AtlanClient
@@ -1057,6 +1058,7 @@ def remove_atlan_tags(
10571058
:param asset_type: type of asset to which to add the Atlan tags
10581059
:param qualified_name: qualified_name of the asset to which to add the Atlan tags
10591060
:param atlan_tag_names: human-readable name of the Atlan tag to remove from the asset
1061+
:returns: the asset that was updated (note that it will NOT contain details of the deleted Atlan tags)
10601062
:raises AtlanError: on any API communication issue
10611063
"""
10621064
from pyatlan.client.atlan import AtlanClient

tests/integration/test_client.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
from tests.integration.requests_test import delete_token
4545

4646
CLASSIFICATION_NAME = "Issue"
47+
CLASSIFICATION_NAME_2 = "Confidential"
4748
SL_SORT_BY_TIMESTAMP = SortItem(field="timestamp", order=SortOrder.ASCENDING)
4849
SL_SORT_BY_GUID = SortItem(field="entityGuidsAll", order=SortOrder.ASCENDING)
4950
SL_SORT_BY_QUALIFIED_NAME = SortItem(
@@ -821,6 +822,38 @@ def test_remove_classification(client: AtlanClient, term1: AtlasGlossaryTerm):
821822
assert not glossary_term.atlan_tags
822823

823824

825+
def test_multiple_add_classification(client: AtlanClient, term1: AtlasGlossaryTerm):
826+
assert term1.qualified_name
827+
client.asset.add_atlan_tags(
828+
AtlasGlossaryTerm,
829+
term1.qualified_name,
830+
[CLASSIFICATION_NAME, CLASSIFICATION_NAME_2],
831+
)
832+
glossary_term = client.asset.get_by_guid(
833+
term1.guid, asset_type=AtlasGlossaryTerm, ignore_relationships=False
834+
)
835+
assert glossary_term.atlan_tags
836+
assert len(glossary_term.atlan_tags) == 2
837+
classification = glossary_term.atlan_tags[0]
838+
assert str(classification.type_name) == CLASSIFICATION_NAME_2
839+
classification_2 = glossary_term.atlan_tags[1]
840+
assert str(classification_2.type_name) == CLASSIFICATION_NAME
841+
842+
843+
@pytest.mark.order(after="test_multiple_add_classification")
844+
def test_multiple_remove_classification(client: AtlanClient, term1: AtlasGlossaryTerm):
845+
assert term1.qualified_name
846+
client.asset.remove_atlan_tags(
847+
AtlasGlossaryTerm,
848+
term1.qualified_name,
849+
[CLASSIFICATION_NAME, CLASSIFICATION_NAME_2],
850+
)
851+
glossary_term = client.asset.get_by_guid(
852+
term1.guid, asset_type=AtlasGlossaryTerm, ignore_relationships=False
853+
)
854+
assert not glossary_term.atlan_tags
855+
856+
824857
def test_glossary_update_certificate(client: AtlanClient, glossary: AtlasGlossary):
825858
_test_update_certificate(client, glossary, AtlasGlossary)
826859

0 commit comments

Comments
 (0)