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

This commit is contained in:
Viraat Chandra 2017-12-29 20:46:05 +05:30 committed by showell
parent 777f6c55f8
commit e2a9a229a3
2 changed files with 43 additions and 9 deletions

View file

@ -6,15 +6,46 @@
}
},
"response": {
"customers": [],
"meta": {
"pagination": {
"has_more": false,
"page": 0,
"per_page": 30,
"total_count": 0
"customers": [
{
"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,
"is_active": true,
"is_canceled": false,
"current_mrr": 1000,
"current_plans": [
{
"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

@ -47,9 +47,12 @@ class TestBaremetricsBot(BotTestCase):
self.verify_reply('list-plans TEST', r)
def test_list_customers_command(self) -> None:
r = '**Listing customers:** \n1.Name: Customer 1\nDisplay Name: Customer 1\nOID: customer_1\nActive: True\n' \
'Email: customer_1@baremetrics.com\nNotes: Here are some notes\nCurrent Plans: \n - Plan 1\n\n'
with self.mock_config_info({'api_key': 'TEST'}):
with self.mock_http_conversation('list_customers'):
self.verify_reply('list-customers TEST', '**Listing customers:** \n')
self.verify_reply('list-customers TEST', r)
def test_list_subscriptions_command(self) -> None:
with self.mock_config_info({'api_key': 'TEST'}):