Skip to content

Commit 7578550

Browse files
authored
Merge pull request #65 from atlanhq/ACTIV-652
Refactor Integration Tests to work on devx.atlan.com
2 parents 633291b + 368fd43 commit 7578550

File tree

15 files changed

+7280
-6622
lines changed

15 files changed

+7280
-6622
lines changed

.github/workflows/pytest.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Python package
22

3-
on: [pull_request, workflow_dispatch]
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
schedule:
7+
- cron : '0 3 * * *' # At 01:00 Daily
48

59
jobs:
610
build:
@@ -34,4 +38,5 @@ jobs:
3438
MARK_API_KEY: ${{ secrets.MARK_ATLAN_API_KEY }}
3539
MARK_BASE_URL: https://mark.atlan.com
3640
run: |
37-
pytest
41+
pytest tests/unit
42+
pytest tests/integration

pyatlan/client/atlan.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
BaseSettings,
1414
HttpUrl,
1515
PrivateAttr,
16+
ValidationError,
1617
parse_obj_as,
1718
validate_arguments,
1819
)
@@ -196,7 +197,7 @@ def _build_typedef_request(typedef: TypeDef) -> TypeDefResponse:
196197
)
197198
else:
198199
raise InvalidRequestException(
199-
"Unable to update type definitions of category: " + typedef.category.value,
200+
f"Unable to update type definitions of category: {typedef.category.value}",
200201
param="category",
201202
)
202203
# Throw an invalid request exception
@@ -284,6 +285,11 @@ def register_client(cls, client: "AtlanClient"):
284285
def get_default_client(cls) -> "Optional[AtlanClient]":
285286
return cls._default_client
286287

288+
@classmethod
289+
def reset_default_client(cls):
290+
"""Sets the default_client to None"""
291+
cls._default_client = None
292+
287293
def __init__(self, **data):
288294
super().__init__(**data)
289295
self._request_params = {"headers": {"authorization": f"Bearer {self.api_key}"}}
@@ -844,7 +850,11 @@ def search(self, criteria: IndexSearchRequest) -> SearchResults:
844850
request_obj=criteria,
845851
)
846852
if "entities" in raw_json:
847-
assets = parse_obj_as(list[Asset], raw_json["entities"])
853+
try:
854+
assets = parse_obj_as(list[Asset], raw_json["entities"])
855+
except ValidationError as err:
856+
LOGGER.error("Problem parsing JSON: %s", raw_json["entities"])
857+
raise err
848858
else:
849859
assets = []
850860
count = raw_json["approximateCount"] if "approximateCount" in raw_json else 0

pyatlan/generator/templates/entity.jinja2

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -374,21 +374,7 @@ class {{ entity_def.name }}({{super_classes[0]}} {%- if "Asset" in super_classes
374374
self.announcement_title = None
375375
self.announcement_type = None
376376
{%- endif %}
377-
{%- if entity_def.name == "Connection" %}
378-
def validate_required(self):
379-
if not self.name:
380-
raise ValueError("name is required")
381-
if not self.admin_roles and not self.admin_groups and not self.admin_users:
382-
raise ValueError(
383-
"One of admin_user, admin_groups or admin_roles is required"
384-
)
385-
if not self.qualified_name:
386-
raise ValueError("qualified_name is required")
387-
if not self.category:
388-
raise ValueError("category is required")
389-
if not self.connector_name:
390-
raise ValueError("connector_name is required")
391-
{%- elif entity_def.name == "Process" %}
377+
{%- if entity_def.name == "Process" %}
392378
@staticmethod
393379
def generate_qualified_name(
394380
name: str,

0 commit comments

Comments
 (0)