Skip to content

Commit 018536a

Browse files
committed
[tests/fix] Fixed failing integration tests due to refactoring changes
1 parent 153f514 commit 018536a

7 files changed

Lines changed: 33 additions & 20 deletions

File tree

pyatlan/client/open_lineage.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def create_connection(
6363
}
6464
response = self._client.credentials.creator(credential=create_credential) # type: ignore[attr-defined]
6565
connection = Connection.creator(
66+
client=self._client,
6667
name=name,
6768
connector_type=connector_type,
6869
admin_users=admin_users,

pyatlan/client/typedef.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def purge(self, name: str, typedef_type: type) -> None:
233233
typedef_type
234234
)
235235
if internal_name:
236-
self._client._client._call_api( # type: ignore[attr-defined]
236+
self._client._call_api( # type: ignore[attr-defined]
237237
DELETE_TYPE_DEF_BY_NAME.format_path_with_params(internal_name)
238238
)
239239
else:

pyatlan/model/search.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1968,6 +1968,17 @@ def validate_sort(cls, sort, values):
19681968
return sort
19691969

19701970

1971+
class IndexSearchRequestMetadata(AtlanObject):
1972+
save_search_log: bool = Field(
1973+
default=False,
1974+
description="Whether to log this search (True) or not (False)",
1975+
)
1976+
utm_tags: List[str] = Field(
1977+
default_factory=list,
1978+
description="Tags to associate with the search request",
1979+
)
1980+
1981+
19711982
class IndexSearchRequest(SearchRequest):
19721983
dsl: DSL
19731984
relation_attributes: Optional[List[str]] = Field(
@@ -2013,26 +2024,13 @@ class IndexSearchRequest(SearchRequest):
20132024
default=None,
20142025
description="Qualified name of the purpose eg: default/zL6uqsrZGuf1hz9XFYnw9x",
20152026
)
2016-
2017-
class Metadata(AtlanObject):
2018-
# Set this to `False` to prevent the frequent
2019-
# Out of memory (OOM) issue in Metastore pods.
2020-
save_search_log: bool = Field(
2021-
default=False,
2022-
description="Whether to log this search (True) or not (False)",
2023-
)
2024-
utm_tags: List[str] = Field(
2025-
default_factory=list,
2026-
description="Tags to associate with the search request",
2027-
)
2028-
2029-
request_metadata: Optional[Metadata] = Field(
2030-
default_factory=lambda: IndexSearchRequest.Metadata(
2027+
request_metadata: Optional[IndexSearchRequestMetadata] = Field(
2028+
default_factory=lambda: IndexSearchRequestMetadata(
20312029
# Set this to `False` to prevent the frequent
20322030
# Out of memory (OOM) issue in Metastore pods.
20332031
save_search_log=False,
20342032
utm_tags=[UTMTags.PROJECT_SDK_PYTHON],
2035-
),
2033+
)
20362034
)
20372035

20382036
class Config:

tests/integration/connection_test.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ def test_invalid_connection(client: AtlanClient):
5656
with pytest.raises(
5757
ValueError, match="One of admin_user, admin_groups or admin_roles is required"
5858
):
59-
Connection.create(name=MODULE_NAME, connector_type=AtlanConnectorType.POSTGRES)
59+
Connection.create(
60+
client=client, name=MODULE_NAME, connector_type=AtlanConnectorType.POSTGRES
61+
)
6062

6163

6264
def test_invalid_connection_admin_role(
@@ -66,6 +68,7 @@ def test_invalid_connection_admin_role(
6668
ValueError, match="Provided role ID abc123 was not found in Atlan."
6769
):
6870
Connection.create(
71+
client=client,
6972
name=MODULE_NAME,
7073
connector_type=AtlanConnectorType.SAPHANA,
7174
admin_roles=["abc123"],
@@ -79,6 +82,7 @@ def test_invalid_connection_admin_group(
7982
ValueError, match="Provided group name abc123 was not found in Atlan."
8083
):
8184
Connection.create(
85+
client=client,
8286
name=MODULE_NAME,
8387
connector_type=AtlanConnectorType.SAPHANA,
8488
admin_groups=["abc123"],
@@ -92,6 +96,7 @@ def test_invalid_connection_admin_user(
9296
ValueError, match="Provided username abc123 was not found in Atlan."
9397
):
9498
Connection.create(
99+
client=client,
95100
name=MODULE_NAME,
96101
connector_type=AtlanConnectorType.SAPHANA,
97102
admin_users=["abc123"],

tests/integration/document_db_asset_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def test_creator(
3030
assert role
3131
connection_name = TestId.make_unique("DOC_Conn")
3232
c = Connection.creator(
33+
client=client,
3334
name=connection_name,
3435
connector_type=AtlanConnectorType.DOCUMENTDB,
3536
admin_roles=[role],

tests/integration/test_client.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,14 @@
3737
UTMTags,
3838
)
3939
from pyatlan.model.fluent_search import CompoundQuery, FluentSearch
40-
from pyatlan.model.search import DSL, Bool, IndexSearchRequest, SortItem, Term
40+
from pyatlan.model.search import (
41+
DSL,
42+
Bool,
43+
IndexSearchRequest,
44+
IndexSearchRequestMetadata,
45+
SortItem,
46+
Term,
47+
)
4148
from pyatlan.model.user import UserMinimalResponse
4249
from tests.integration.client import TestId
4350
from tests.integration.lineage_test import create_database, delete_asset
@@ -1227,7 +1234,7 @@ def _view_test_glossary_by_search(
12271234
index = (
12281235
FluentSearch().where(Asset.GUID.eq(sl_glossary.guid, case_insensitive=True))
12291236
).to_request()
1230-
index.request_metadata = IndexSearchRequest.Metadata(
1237+
index.request_metadata = IndexSearchRequestMetadata(
12311238
utm_tags=[
12321239
UTMTags.ACTION_ASSET_VIEWED,
12331240
UTMTags.UI_PROFILE,

tests/integration/test_sql_assets.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ def test_create(
7979
assert role
8080
connection_name = TestId.make_unique("INT")
8181
c = Connection.create(
82+
client=client,
8283
name=connection_name,
8384
connector_type=AtlanConnectorType.SNOWFLAKE,
8485
admin_roles=[role],

0 commit comments

Comments
 (0)