From cf865fbf806f1b3a661c8351c1cebc8643198783 Mon Sep 17 00:00:00 2001 From: Jan Kadlec Date: Thu, 24 Oct 2024 11:47:48 +0200 Subject: [PATCH] fix: automation deser for first_run Use str instead of datetime. JIRA: TRIVIAL risk: low --- .../declarative_model/workspace/automation.py | 3 +-- .../workspaces/layout_automations.yaml | 18 ++++++++++-------- .../tests/catalog/test_catalog_workspace.py | 4 +--- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/gooddata-sdk/gooddata_sdk/catalog/workspace/declarative_model/workspace/automation.py b/gooddata-sdk/gooddata_sdk/catalog/workspace/declarative_model/workspace/automation.py index 5213a1f4a..ab41a93ef 100644 --- a/gooddata-sdk/gooddata_sdk/catalog/workspace/declarative_model/workspace/automation.py +++ b/gooddata-sdk/gooddata_sdk/catalog/workspace/declarative_model/workspace/automation.py @@ -1,6 +1,5 @@ # (C) 2024 GoodData Corporation import builtins -from datetime import datetime from typing import Any, Optional from attrs import define, field @@ -26,7 +25,7 @@ class CatalogAutomationSchedule(Base): cron: str cron_description: Optional[str] = field(default=None, eq=False) - first_run: Optional[datetime] = None + first_run: Optional[str] = None timezone: Optional[str] = "UTC" @staticmethod diff --git a/gooddata-sdk/tests/catalog/fixtures/workspaces/layout_automations.yaml b/gooddata-sdk/tests/catalog/fixtures/workspaces/layout_automations.yaml index c1281ba8d..1588032a3 100644 --- a/gooddata-sdk/tests/catalog/fixtures/workspaces/layout_automations.yaml +++ b/gooddata-sdk/tests/catalog/fixtures/workspaces/layout_automations.yaml @@ -69,7 +69,7 @@ interactions: X-XSS-Protection: - '0' set-cookie: - - SPRING_REDIRECT_URI=; Max-Age=0; Expires=Wed, 23 Oct 2024 11:21:42 GMT; + - SPRING_REDIRECT_URI=; Max-Age=0; Expires=Thu, 24 Oct 2024 09:45:11 GMT; Path=/; HTTPOnly; SameSite=Lax body: string: [] @@ -143,7 +143,7 @@ interactions: X-XSS-Protection: - '0' set-cookie: - - SPRING_REDIRECT_URI=; Max-Age=0; Expires=Wed, 23 Oct 2024 11:21:42 GMT; + - SPRING_REDIRECT_URI=; Max-Age=0; Expires=Thu, 24 Oct 2024 09:45:11 GMT; Path=/; HTTPOnly; SameSite=Lax body: string: '' @@ -161,6 +161,7 @@ interactions: type: notificationChannel schedule: cron: 0 0 * * * + firstRun: '2023-10-05T14:30:00+00:00' timezone: UTC headers: Accept-Encoding: @@ -221,7 +222,7 @@ interactions: X-XSS-Protection: - '0' set-cookie: - - SPRING_REDIRECT_URI=; Max-Age=0; Expires=Wed, 23 Oct 2024 11:21:42 GMT; + - SPRING_REDIRECT_URI=; Max-Age=0; Expires=Thu, 24 Oct 2024 09:45:11 GMT; Path=/; HTTPOnly; SameSite=Lax body: string: '' @@ -292,9 +293,9 @@ interactions: X-XSS-Protection: - '0' content-length: - - '203' + - '237' set-cookie: - - SPRING_REDIRECT_URI=; Max-Age=0; Expires=Wed, 23 Oct 2024 11:21:42 GMT; + - SPRING_REDIRECT_URI=; Max-Age=0; Expires=Thu, 24 Oct 2024 09:45:11 GMT; Path=/; HTTPOnly; SameSite=Lax body: string: @@ -306,6 +307,7 @@ interactions: type: notificationChannel schedule: cron: 0 0 * * * + firstRun: '2023-10-05T14:30:00Z' timezone: UTC state: ACTIVE title: Automation @@ -372,7 +374,7 @@ interactions: X-XSS-Protection: - '0' set-cookie: - - SPRING_REDIRECT_URI=; Max-Age=0; Expires=Wed, 23 Oct 2024 11:21:42 GMT; + - SPRING_REDIRECT_URI=; Max-Age=0; Expires=Thu, 24 Oct 2024 09:45:11 GMT; Path=/; HTTPOnly; SameSite=Lax body: string: '' @@ -443,7 +445,7 @@ interactions: X-XSS-Protection: - '0' set-cookie: - - SPRING_REDIRECT_URI=; Max-Age=0; Expires=Wed, 23 Oct 2024 11:21:42 GMT; + - SPRING_REDIRECT_URI=; Max-Age=0; Expires=Thu, 24 Oct 2024 09:45:11 GMT; Path=/; HTTPOnly; SameSite=Lax body: string: [] @@ -511,7 +513,7 @@ interactions: X-XSS-Protection: - '0' set-cookie: - - SPRING_REDIRECT_URI=; Max-Age=0; Expires=Wed, 23 Oct 2024 11:21:42 GMT; + - SPRING_REDIRECT_URI=; Max-Age=0; Expires=Thu, 24 Oct 2024 09:45:11 GMT; Path=/; HTTPOnly; SameSite=Lax body: string: '' diff --git a/gooddata-sdk/tests/catalog/test_catalog_workspace.py b/gooddata-sdk/tests/catalog/test_catalog_workspace.py index 5228c384c..7651c7619 100644 --- a/gooddata-sdk/tests/catalog/test_catalog_workspace.py +++ b/gooddata-sdk/tests/catalog/test_catalog_workspace.py @@ -947,9 +947,7 @@ def test_layout_automations(test_config): title="Automation", state="ACTIVE", notification_channel=CatalogNotificationChannelIdentifier(id="webhook"), - schedule=CatalogAutomationSchedule( - cron="0 0 * * *", - ), + schedule=CatalogAutomationSchedule(cron="0 0 * * *", first_run="2023-10-05 14:30:00+00:00"), metadata={"key": "value"}, ) ]