Skip to content

Use the Paddle sandbox environment for testing #6

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

Merged
merged 30 commits into from
Mar 26, 2021
Merged

Conversation

pyepye
Copy link
Member

@pyepye pyepye commented Mar 23, 2021

Based on the work @Wolf-Byte started with the sandbox environment here - #4

Adds the following:

  • Ensures all tests use the sandbox
  • Updates sandbox url style to make it run once on init
  • Add notes on how to setup the sandbox account to make tests pass
  • Update tests to use fixtures instead of configured environmental variables
  • Remove pytest skips and warnings - fail load when test data does not exist
  • Move all tests to use a specially created Sandbox account
  • Test paddle client warnings
  • Fix up create pay link endpoint and test issues
  • Test create_pay_link exceptions
  • Fix up Generate License test issues
  • Removes preview_subscription_update as it's not longer a Paddle API endpoint
  • Change user_history to not use hardcoded vendor ID's or email addresses
  • More tests to get to 100% coverage

Wolf-Byte and others added 30 commits February 25, 2021 12:38
… not return a 'plan' according to the Schema, this resulted in a KeyError. Please see documentation for the Schema https://developer.paddle.com/api-reference/subscription-api/payments/listpayments
…e amount. The assert is then used to compare the expected amount (new_quantity * amount) with the next_payment amount returned from preview_update_subscription.
…as the passthrough value can be null which raises an AssertionError. You may want to remove the check entirely instead of having an OR statement.

https://developer.paddle.com/api-reference/product-api/transactions/listtransactions
…on checks on the passthrough value I found the list_transactions was not failing when a subscription was being passed (despite the passthrough returning null in postman). After investigating I found the plan_id (PADDLE_TEST_DEFAULT_PLAN_ID) was being passed as the subscription_id. In this instance the paddle API responds with {"success": true, "response": []} as the response is an empty list test never failed. Instead of passing a plan_id we should pass a subscription_id.
… avoid error "amount is less than allowed minimum transaction amount" (Paddle error 186). Also fix assertion check on the amount as paddle returns the value to three decimal places.
Add constructor parameter 'sandbox' to PaddleClient to enable sandbox mode
If the parameter 'sandbox' is not passed in the constructor the option is loaded form the Environment variable 'PADDLE_SANDBOX' (default=False)
Add get_environment_url(self, url) function to PaddleClient() which checks if sandbox has been enabled and if it had it prepends 'sandbox-' to the subdomain. Returns url
Update PaddleClient request() to get the environment url after building and validating the url
Update all tests to call paddle_client.get_environment_url()
@pyepye pyepye changed the title Sandbox tests Use the Paddle sandbox environment for testing Mar 26, 2021
@pyepye pyepye merged commit 4a5e07d into master Mar 26, 2021
@pyepye pyepye deleted the sandbox-tests branch March 26, 2021 01:28
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.

2 participants