zulip_bots: Add better test for list-subscriptions command of Baremetrics bot.

This commit is contained in:
Viraat Chandra 2017-12-29 20:57:20 +05:30 committed by showell
parent e2a9a229a3
commit 606b7f8adf
2 changed files with 50 additions and 8 deletions

View file

@ -6,14 +6,52 @@
}
},
"response": {
"subscriptions": [],
"meta": {
"pagination": {
"has_more": false,
"page": 0,
"per_page": 30
"subscriptions": [
{
"oid": "subscription_1",
"source_id": "source_1",
"source": "stripe",
"customer": {
"oid": "customer_1",
"source_id": "source_1",
"source": "stripe",
"created": 1492605754,
"email": "customer_1@baremetrics.com",
"name": "Customer 1",
"display_image": "https://logo.clearbit.com/baremetrics.com",
"display_name": "Customer 1",
"notes": "Here are some notes",
"ltv": 50000
},
"canceled_at": null,
"started_at": 1492605754,
"processed": true,
"active": true,
"quantity": 1,
"discount": 0,
"plan": {
"oid": "plan_1",
"source_id": "source_1",
"source": "stripe",
"name": "Plan 1",
"interval": "month",
"interval_count": 1,
"trial_duration": null,
"trial_duration_unit": null,
"created": 1492605754,
"active": true,
"setup_fees": 0,
"amounts": [
{
"currency": "USD",
"symbol": "$",
"symbol_right": false,
"amount": 1000
}
]
}
}
]
},
"response-headers": {
"X-TokenExpires": "0",

View file

@ -55,6 +55,10 @@ class TestBaremetricsBot(BotTestCase):
self.verify_reply('list-customers TEST', r)
def test_list_subscriptions_command(self) -> None:
r = '**Listing subscriptions:** \n1.Customer Name: Customer 1\nCustomer Display Name: Customer 1\n' \
'Customer OID: customer_1\nCustomer Email: customer_1@baremetrics.com\nActive: True\n' \
'Plan Name: Plan 1\nPlan Amounts: \n - 1000 $\n\n'
with self.mock_config_info({'api_key': 'TEST'}):
with self.mock_http_conversation('list_subscriptions'):
self.verify_reply('list-subscriptions TEST', '**Listing subscriptions:** \n')
self.verify_reply('list-subscriptions TEST', r)