-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_pricing_table.py
43 lines (39 loc) · 1.36 KB
/
test_pricing_table.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import pytest
from unittest import mock
import spackle
class TestPricingTable:
def test_retrieve(self):
data = {
"id": "abc123",
"name": "Test Pricing Table",
"intervals": ["month", "year"],
"products": [
{
"id": "prod_abc123",
"features": [
{
"key": "test_feature",
"name": "Test Feature",
"type": spackle.FEATURE_TYPE_FLAG,
"value_flag": True,
}
],
"name": "Basic",
"prices": {
"month": {
"currency": "usd",
"unit_amount": 1000,
},
"year": {
"currency": "usd",
"unit_amount": 10000,
},
},
}
],
}
with mock.patch("spackle.pricing_table.requests.get") as mock_get:
mock_get.return_value.status_code = 200
mock_get.return_value.json.return_value = data
pricing_table = spackle.PricingTable.retrieve("abc123")
assert pricing_table == data