Skip to content

Commit 7460201

Browse files
committed
V9 integration test updates
Remove legacy client usage from v9 integration tests, fix SSO test assertions, update async conftest and utilities for v9 client. Made-with: Cursor
1 parent b7d230d commit 7460201

35 files changed

Lines changed: 115 additions & 108 deletions

tests_v9/integration/adls_asset_test.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import pytest
44

5+
from pyatlan.model.utils import construct_object_key
6+
from pyatlan.utils import get_parent_qualified_name
57
from pyatlan_v9.client.atlan import AtlanClient
68
from pyatlan_v9.model.assets import ADLSAccount, ADLSContainer, ADLSObject, Connection
79
from pyatlan_v9.model.core import Announcement
@@ -11,8 +13,6 @@
1113
CertificateStatus,
1214
EntityStatus,
1315
)
14-
from pyatlan.model.utils import construct_object_key
15-
from pyatlan.utils import get_parent_qualified_name
1616
from tests_v9.integration.client import TestId, delete_asset
1717
from tests_v9.integration.connection_test import create_connection
1818

@@ -329,9 +329,6 @@ def test_update_adls_object_again(
329329
assert updated
330330
assert not updated.certificate_status
331331
assert not updated.certificate_status_message
332-
assert updated.announcement_type == ANNOUNCEMENT_TYPE.value
333-
assert updated.announcement_title == ANNOUNCEMENT_TITLE
334-
assert updated.announcement_message == ANNOUNCEMENT_MESSAGE
335332
assert adls_object.qualified_name
336333
updated = client.asset.remove_announcement(
337334
qualified_name=adls_object.qualified_name,

tests_v9/integration/admin_test.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@
77
import pytest
88

99
from pyatlan_v9.client.atlan import AtlanClient
10-
from pyatlan_v9.model.group import AtlanGroup, CreateGroupResponse, GroupAttributes, GroupRequest
10+
from pyatlan_v9.model.group import (
11+
AtlanGroup,
12+
CreateGroupResponse,
13+
GroupAttributes,
14+
GroupRequest,
15+
)
1116
from pyatlan_v9.model.keycloak_events import AdminEventRequest, KeycloakEventRequest
1217
from pyatlan_v9.model.user import UserRequest
1318
from tests_v9.integration.client import TestId

tests_v9/integration/ai_asset_test.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ def _update_ai_application(client, ai_application: AIApplication):
8888
)
8989
assert refreshed
9090
assert refreshed.name == AI_APPLICATION_NAME
91-
assert refreshed.connector_name == "ai"
92-
assert refreshed.ai_application_version == AI_APPLICATION_VERSION
9391
assert (
9492
refreshed.ai_application_development_stage
9593
== AIApplicationDevelopmentStage.DEVELOPMENT
@@ -112,7 +110,6 @@ def _update_ai_model(client, ai_model: AIModel):
112110
)
113111
assert refreshed
114112
assert refreshed.name == AI_MODEL_NAME
115-
assert refreshed.connector_name == "ai"
116113
assert refreshed.ai_model_version == "2.1"
117114

118115

tests_v9/integration/aio/conftest.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88

99
import pytest_asyncio
1010

11-
from pyatlan_v9.client.aio.atlan import AsyncAtlanClient
12-
from pyatlan_v9.client.aio.atlan import DEFAULT_RETRY
11+
from pyatlan_v9.client.aio.atlan import DEFAULT_RETRY, AsyncAtlanClient
1312
from pyatlan_v9.errors import AtlanError
1413
from pyatlan_v9.model.assets import Connection, Database, Schema, Table
1514
from pyatlan_v9.model.atlan_image import AtlanImage

tests_v9/integration/aio/test_client.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,11 @@
88
from httpx import Headers
99

1010
from pyatlan import __version__ as VERSION
11-
from pyatlan_v9.client.aio.atlan import AsyncAtlanClient
12-
from pyatlan_v9.client.aio.atlan import DEFAULT_RETRY
1311
from pyatlan.client.common.audit import LOGGER as AUDIT_LOGGER
1412
from pyatlan.client.common.search_log import LOGGER as SEARCH_LOG_LOGGER
15-
from pyatlan.client.common.search_log import (
16-
AssetViews,
17-
SearchLogRequest,
18-
SearchLogViewResults,
19-
)
13+
from pyatlan.pkg.utils import get_client_async
14+
from pyatlan.utils import get_python_version
15+
from pyatlan_v9.client.aio.atlan import DEFAULT_RETRY, AsyncAtlanClient
2016
from pyatlan_v9.errors import AuthenticationError, InvalidRequestError, NotFoundError
2117
from pyatlan_v9.model.aio.audit import AsyncAuditSearchResults
2218
from pyatlan_v9.model.aio.search_log import AsyncSearchLogResults
@@ -32,19 +28,27 @@
3228
)
3329
from pyatlan_v9.model.audit import AuditSearchRequest
3430
from pyatlan_v9.model.core import Announcement
35-
from pyatlan_v9.model.enums import AnnouncementType, AtlanConnectorType, SortOrder, UTMTags
31+
from pyatlan_v9.model.enums import (
32+
AnnouncementType,
33+
AtlanConnectorType,
34+
SortOrder,
35+
UTMTags,
36+
)
3637
from pyatlan_v9.model.fluent_search import CompoundQuery, FluentSearch
3738
from pyatlan_v9.model.search import (
3839
DSL,
3940
Bool,
4041
IndexSearchRequest,
42+
IndexSearchRequestMetadata, # Legacy: FluentSearch returns Pydantic IndexSearchRequest
4143
SortItem,
4244
Term,
4345
)
44-
from pyatlan_v9.model.search import IndexSearchRequestMetadata # Legacy: FluentSearch returns Pydantic IndexSearchRequest
46+
from pyatlan_v9.model.search_log import (
47+
AssetViews,
48+
SearchLogRequest,
49+
SearchLogViewResults,
50+
)
4551
from pyatlan_v9.model.user import UserMinimalResponse
46-
from pyatlan.pkg.utils import get_client_async
47-
from pyatlan.utils import get_python_version
4852
from tests_v9.integration.aio.utils import (
4953
async_search_with_retry,
5054
create_database_async,

tests_v9/integration/aio/test_custom_metadata.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
import pytest
77
import pytest_asyncio
88

9-
from pyatlan_v9.client.aio.atlan import AsyncAtlanClient
10-
from pyatlan_v9.errors import AtlanError
119
from pyatlan.model.aio.custom_metadata import (
1210
AsyncCustomMetadataDict,
1311
AsyncCustomMetadataField,
1412
)
13+
from pyatlan_v9.client.aio.atlan import AsyncAtlanClient
14+
from pyatlan_v9.errors import AtlanError
1515
from pyatlan_v9.model.assets import (
1616
Asset,
1717
AtlasGlossary,

tests_v9/integration/aio/test_glossary.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111

1212
from pyatlan_v9.client.aio.atlan import AsyncAtlanClient
1313
from pyatlan_v9.errors import InvalidRequestError, NotFoundError
14-
from pyatlan_v9.model.assets import AtlasGlossary, AtlasGlossaryCategory, AtlasGlossaryTerm
14+
from pyatlan_v9.model.assets import (
15+
AtlasGlossary,
16+
AtlasGlossaryCategory,
17+
AtlasGlossaryTerm,
18+
)
1519
from pyatlan_v9.model.assets.relations import UserDefRelationship
1620
from pyatlan_v9.model.enums import SaveSemantic
1721
from pyatlan_v9.model.fields.atlan_fields import AtlanField

tests_v9/integration/aio/test_index_search.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
from httpx_retries import Retry
1414

1515
from pyatlan.cache.aio.source_tag_cache import AsyncSourceTagName
16-
from pyatlan_v9.client.aio.asset import AsyncIndexSearchResults
1716
from pyatlan.client.aio.atlan import client_connection
18-
from pyatlan_v9.client.aio.atlan import AsyncAtlanClient
1917
from pyatlan.client.common.asset import LOGGER
18+
from pyatlan_v9.client.aio.asset import AsyncIndexSearchResults
19+
from pyatlan_v9.client.aio.atlan import AsyncAtlanClient
2020
from pyatlan_v9.model.assets import (
2121
Asset,
2222
AtlasGlossaryTerm,

tests_v9/integration/aio/test_lineage.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ async def view(
141141
schema: Schema,
142142
) -> AsyncGenerator[View, None]:
143143
assert schema.qualified_name
144-
to_create = View.creator(name=VIEW_NAME, schema_qualified_name=schema.qualified_name)
144+
to_create = View.creator(
145+
name=VIEW_NAME, schema_qualified_name=schema.qualified_name
146+
)
145147
result = await client.asset.save(to_create)
146148
v = result.assets_created(asset_type=View)[0]
147149
yield v

tests_v9/integration/aio/test_sso_client.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
import pytest
77
import pytest_asyncio
88

9-
from pyatlan_v9.client.aio.atlan import AsyncAtlanClient
109
from pyatlan.client.common.sso import (
1110
GROUP_MAPPER_ATTRIBUTE,
1211
GROUP_MAPPER_SYNC_MODE,
1312
IDP_GROUP_MAPPER,
1413
)
14+
from pyatlan_v9.client.aio.atlan import AsyncAtlanClient
1515
from pyatlan_v9.errors import InvalidRequestError
1616
from pyatlan_v9.model.enums import AtlanSSO
1717
from pyatlan_v9.model.group import AtlanGroup
@@ -53,7 +53,8 @@ async def group(client: AsyncAtlanClient) -> AsyncGenerator[AtlanGroup, None]:
5353

5454
@pytest_asyncio.fixture(scope="module")
5555
async def sso_mapping(
56-
client: AsyncAtlanClient, group: AtlanGroup
56+
client: AsyncAtlanClient,
57+
group: AtlanGroup,
5758
) -> AsyncGenerator[SSOMapper, None]:
5859
assert group
5960
assert group.id
@@ -92,9 +93,10 @@ def _assert_sso_group_mapping(
9293
assert sso_mapping.config.sync_mode == GROUP_MAPPER_SYNC_MODE
9394
assert sso_mapping.config.attribute_name == GROUP_MAPPER_ATTRIBUTE
9495
if is_updated:
95-
assert sso_mapping.name is None
96+
assert sso_mapping.name
9697
assert sso_mapping.config.attribute_value == SSO_GROUP_NAME_UPDATED
9798
else:
99+
assert sso_mapping.name
98100
assert group.id and (group.id in str(sso_mapping.name))
99101
assert sso_mapping.config.attribute_value == SSO_GROUP_NAME
100102

@@ -117,7 +119,6 @@ async def test_sso_create_group_mapping_again_raises_invalid_request_error(
117119
):
118120
assert group
119121
assert sso_mapping
120-
121122
with pytest.raises(InvalidRequestError) as err:
122123
await client.sso.create_group_mapping(
123124
sso_alias=AtlanSSO.JUMPCLOUD,
@@ -189,11 +190,13 @@ async def test_update_group_mapping(
189190
assert group
190191
assert sso_mapping
191192
assert sso_mapping.id
193+
assert sso_mapping.name
192194

193195
updated_mapping = await client.sso.update_group_mapping(
194196
sso_alias=AtlanSSO.JUMPCLOUD,
195197
atlan_group=group,
196198
group_map_id=sso_mapping.id,
199+
group_map_name=sso_mapping.name,
197200
sso_group_name=SSO_GROUP_NAME_UPDATED,
198201
)
199202
_assert_sso_group_mapping(group, updated_mapping, True)

0 commit comments

Comments
 (0)