zulip_bots: Add better test for `list-customers` command of Baremetrics bot.
MODIFY
zulip_bots/zulip_bots/bots/baremetrics/fixtures/list_customers.json
zulip_bots/zulip_bots/bots/baremetrics/fixtures/list_customers.json
}
},
"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",

MODIFY
zulip_bots/zulip_bots/bots/baremetrics/test_baremetrics.py
zulip_bots/zulip_bots/bots/baremetrics/test_baremetrics.py
@@ -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'}):

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