Skip to content

Commit

Permalink
Merge pull request #75 from alice-biometrics/fix/flow-responses-as-json
Browse files Browse the repository at this point in the history
fix: retrieve_flows and retrieve_flow returns json
  • Loading branch information
miguel-lorenzo committed Aug 11, 2023
2 parents cb7d345 + aa95be9 commit 8ca0ae4
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 17 deletions.
4 changes: 2 additions & 2 deletions alice/onboarding/onboarding.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
8 changes: 1 addition & 7 deletions alice/webhooks/webhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 0 additions & 7 deletions alice/webhooks/webhooks_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_integration_webhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down

0 comments on commit 8ca0ae4

Please sign in to comment.