This repository has been archived by the owner on May 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7b18a55
commit 63ac3b6
Showing
4 changed files
with
300 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__VERSION__ = '0.0.1a65' | ||
__VERSION__ = '0.0.1a66' |
Empty file.
255 changes: 255 additions & 0 deletions
255
tests/Functional/Resources/EventTypes/_fixtures/response/list_default.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,255 @@ | ||
{ | ||
"data": [ | ||
{ | ||
"name": "transaction.billed", | ||
"description": "Occurs when a transaction is billed. Its status field changes to billed and billed_at is populated.", | ||
"group": "Transaction", | ||
"available_versions": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"name": "transaction.canceled", | ||
"description": "Occurs when a transaction is canceled. Its status field changes to canceled.", | ||
"group": "Transaction", | ||
"available_versions": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"name": "transaction.completed", | ||
"description": "Occurs when a transaction is completed. Its status field changes to completed.", | ||
"group": "Transaction", | ||
"available_versions": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"name": "transaction.created", | ||
"description": "Occurs when a transaction is created.", | ||
"group": "Transaction", | ||
"available_versions": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"name": "transaction.past_due", | ||
"description": "Occurs when a transaction becomes past due. Its status field changes to past_due.", | ||
"group": "Transaction", | ||
"available_versions": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"name": "transaction.payment_failed", | ||
"description": "Occurs when a payment fails for a transaction. The payments array is updated with details of the payment attempt.", | ||
"group": "Transaction", | ||
"available_versions": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"name": "transaction.ready", | ||
"description": "Occurs when a transaction is ready to be billed. Its status field changes to ready.", | ||
"group": "Transaction", | ||
"available_versions": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"name": "transaction.updated", | ||
"description": "Occurs when a transaction is updated.", | ||
"group": "Transaction", | ||
"available_versions": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"name": "subscription.activated", | ||
"description": "Occurs when a subscription becomes active. Its status field changes to active. This means any trial period has elapsed and Paddle has successfully billed the customer.", | ||
"group": "Subscription", | ||
"available_versions": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"name": "subscription.canceled", | ||
"description": "Occurs when a subscription is canceled. Its status field changes to canceled.", | ||
"group": "Subscription", | ||
"available_versions": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"name": "subscription.created", | ||
"description": "Occurs when a subscription is created. subscription.trialing or subscription.activated typically follow.", | ||
"group": "Subscription", | ||
"available_versions": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"name": "subscription.imported", | ||
"description": "Occurs when a subscription is imported.", | ||
"group": "Subscription", | ||
"available_versions": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"name": "subscription.past_due", | ||
"description": "Occurs when a subscription has an unpaid transaction. Its status changes to past_due.", | ||
"group": "Subscription", | ||
"available_versions": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"name": "subscription.paused", | ||
"description": "Occurs when a subscription is paused. Its status field changes to paused.", | ||
"group": "Subscription", | ||
"available_versions": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"name": "subscription.resumed", | ||
"description": "Occurs when a subscription is resumed after being paused. Its status field changes to active.", | ||
"group": "Subscription", | ||
"available_versions": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"name": "subscription.trialing", | ||
"description": "Occurs when a subscription enters trial period.", | ||
"group": "Subscription", | ||
"available_versions": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"name": "subscription.updated", | ||
"description": "Occurs when a subscription is updated.", | ||
"group": "Subscription", | ||
"available_versions": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"name": "product.created", | ||
"description": "Occurs when a product is created.", | ||
"group": "Product", | ||
"available_versions": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"name": "product.updated", | ||
"description": "Occurs when a product is updated.", | ||
"group": "Product", | ||
"available_versions": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"name": "price.created", | ||
"description": "Occurs when a price is created.", | ||
"group": "Price", | ||
"available_versions": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"name": "price.updated", | ||
"description": "Occurs when a price is updated.", | ||
"group": "Price", | ||
"available_versions": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"name": "discount.created", | ||
"description": "Occurs when a discount is created.", | ||
"group": "Discount", | ||
"available_versions": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"name": "discount.updated", | ||
"description": "Occurs when a discount is updated.", | ||
"group": "Discount", | ||
"available_versions": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"name": "customer.created", | ||
"description": "Occurs when a customer is created.", | ||
"group": "Customer", | ||
"available_versions": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"name": "customer.updated", | ||
"description": "Occurs when a customer is updated.", | ||
"group": "Customer", | ||
"available_versions": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"name": "address.created", | ||
"description": "Occurs when an address is created.", | ||
"group": "Address", | ||
"available_versions": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"name": "address.updated", | ||
"description": "Occurs when an address is updated.", | ||
"group": "Address", | ||
"available_versions": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"name": "business.created", | ||
"description": "Occurs when a business is created.", | ||
"group": "Business", | ||
"available_versions": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"name": "business.updated", | ||
"description": "Occurs when a business is updated.", | ||
"group": "Business", | ||
"available_versions": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"name": "adjustment.created", | ||
"description": "Occurs when an adjustment is created.", | ||
"group": "Adjustment", | ||
"available_versions": [ | ||
1 | ||
] | ||
}, | ||
{ | ||
"name": "adjustment.updated", | ||
"description": "Occurs when an adjustment is updated, the only time an adjustment will be updated is when the status changes from pending to approved or from pending to rejected.", | ||
"group": "Adjustment", | ||
"available_versions": [ | ||
1 | ||
] | ||
} | ||
], | ||
"meta": { | ||
"request_id": "83fad52c-fcd1-440e-a222-16b727e5262b" | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
tests/Functional/Resources/EventTypes/test_EventTypesClient.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from json import loads | ||
from pytest import mark | ||
from urllib.parse import unquote | ||
|
||
from paddle_billing_python_sdk.Environment import Environment | ||
|
||
from paddle_billing_python_sdk.Entities.Collections.EventTypeCollection import EventTypeCollection | ||
|
||
from tests.Utils.TestClient import mock_requests, test_client | ||
from tests.Utils.ReadsFixture import ReadsFixtures | ||
|
||
|
||
class TestEventTypesClient: | ||
@mark.parametrize( | ||
'expected_response_status, expected_response_body, expected_url', | ||
[( | ||
200, | ||
ReadsFixtures.read_raw_json_fixture('response/list_default'), | ||
f"{Environment.SANDBOX.base_url}/event-types", | ||
)], | ||
ids = ["List event types"], | ||
) | ||
def test_list_event_types( | ||
self, | ||
test_client, | ||
mock_requests, | ||
expected_response_status, | ||
expected_response_body, | ||
expected_url, | ||
): | ||
mock_requests.get(expected_url, status_code=expected_response_status, text=expected_response_body) | ||
|
||
response = test_client.client.event_types.list() | ||
response_json = test_client.client.event_types.response.json() | ||
last_request = mock_requests.last_request | ||
|
||
assert isinstance(response, EventTypeCollection) | ||
assert last_request is not None | ||
assert last_request.method == 'GET' | ||
assert test_client.client.status_code == expected_response_status | ||
assert unquote(last_request.url) == expected_url, \ | ||
"The URL does not match the expected URL, verify the query string is correct" | ||
assert response_json == loads(expected_response_body), \ | ||
"The response JSON doesn't match the expected fixture JSON" |