Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stripe endpoint tests #4329

Merged
merged 2 commits into from
Mar 9, 2023
Merged

Stripe endpoint tests #4329

merged 2 commits into from
Mar 9, 2023

Conversation

LMNTL
Copy link
Contributor

@LMNTL LMNTL commented Mar 8, 2023

Checklist

  1. If you've added code that should be tested, add tests
  2. If you've changed APIs, update (or create!) the documentation
  3. Ensure the tests pass
  4. Make sure that your code lints and that you've followed our coding style
  5. Write a description of your work suitable for publishing on our forum
  6. Mention any related issues in this repository (as #ISSUE) and in other repositories (as kobotoolbox/other#ISSUE)
  7. Open an issue in the docs if there are UI/UX changes

Description

Adds tests for the Stripe checkout link and customer portal API endpoints. Also fixes some issues with the endpoints discovered while getting tests passing.

Related issues

@LMNTL LMNTL requested a review from bufke March 8, 2023 22:56
kobo/apps/stripe/views.py Show resolved Hide resolved
)
except ObjectDoesNotExist:
return Response({'status': 'Price not found or inactive'}, status=status.HTTP_404_NOT_FOUND)
Price.objects.get(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the idea here that we actively want it to error when no price exists? I don't think I have an opinion between a GET with 404 vs POST. I'm not sure I like this uncaught DoesNotExist possibility. An end user could not understand our API and send random price ids that don't exist. That should generate a 4xx level error. I could see some justification to log a warning to help get our attention but I don't see it as an error if the end user of the API can generate it.

It could be solved by adjusting the serializer to actually reference the Price by id instead of just a CharField. Unsure if this would make the code easier to read or not.

Not a blocker but let's change or discuss this.

@bufke bufke merged commit 24d6e8b into feature/billing Mar 9, 2023
@LMNTL LMNTL deleted the stripe-endpoint-tests branch March 9, 2023 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants