From 874f58d061e18da7fd9303f8d46c36b649264640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Fraga=20Bouz=C3=B3n?= Date: Fri, 11 Aug 2023 10:12:27 +0200 Subject: [PATCH 1/2] fix: retrieve_flows and retrieve_flow returns json --- alice/onboarding/onboarding.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/alice/onboarding/onboarding.py b/alice/onboarding/onboarding.py index 5d0a3cf..71c6557 100644 --- a/alice/onboarding/onboarding.py +++ b/alice/onboarding/onboarding.py @@ -1743,7 +1743,7 @@ def retrieve_flow( ).unwrap_or_return() if response.status_code == 200: - return Success(response.content) + return Success(response.json()) else: return Failure( OnboardingError.from_response( @@ -1773,7 +1773,7 @@ def retrieve_flows( ).unwrap_or_return() if response.status_code == 200: - return Success(response.content) + return Success(response.json()) else: return Failure( OnboardingError.from_response( From aa95be9738ef590c31820ba8990b179246913e96 Mon Sep 17 00:00:00 2001 From: Miguel Lorenzo Date: Fri, 11 Aug 2023 11:00:49 +0200 Subject: [PATCH 2/2] fix: replace get_available_events with get_subscriptable_events --- alice/webhooks/webhooks.py | 8 +------- alice/webhooks/webhooks_client.py | 7 ------- tests/test_integration_webhooks.py | 2 +- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/alice/webhooks/webhooks.py b/alice/webhooks/webhooks.py index 41a7fe4..76058e5 100644 --- a/alice/webhooks/webhooks.py +++ b/alice/webhooks/webhooks.py @@ -70,16 +70,10 @@ def get_subscriptable_events( else: return Failure( OnboardingError.from_response( - operation="get_available_events", response=response + operation="get_subscriptable_events", response=response ) ) - @early_return - def get_available_events( - self, verbose: Optional[bool] = False - ) -> Result[bool, Union[OnboardingError, AuthError]]: - return self.get_subscriptable_events(verbose) - @early_return def create_webhook( self, webhook: Webhook, verbose: Optional[bool] = False diff --git a/alice/webhooks/webhooks_client.py b/alice/webhooks/webhooks_client.py index 7ca3fcc..7d81262 100644 --- a/alice/webhooks/webhooks_client.py +++ b/alice/webhooks/webhooks_client.py @@ -68,13 +68,6 @@ def get_subscriptable_events( return Success(response) - @early_return - @timeit - def get_available_events( - self, verbose: Optional[bool] = False - ) -> Result[Response, AuthError]: - return self.get_available_events(verbose) # type: ignore - @early_return @timeit def create_webhook( diff --git a/tests/test_integration_webhooks.py b/tests/test_integration_webhooks.py index c1224f0..4b2adaf 100644 --- a/tests/test_integration_webhooks.py +++ b/tests/test_integration_webhooks.py @@ -25,7 +25,7 @@ def test_should_execute_all_webhook_lifecycle(given_valid_api_key): webhooks_client = Webhooks.from_config(config) # Check Available events - result = webhooks_client.get_available_events() + result = webhooks_client.get_subscriptable_events() assert_success(result, value_is_instance_of=list) selected_event = result.value[0]