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

This commit is contained in:
Viraat Chandra 2017-12-29 20:38:49 +05:30 committed by showell
parent 9bf64c0c21
commit 777f6c55f8
2 changed files with 48 additions and 8 deletions

View file

@ -6,14 +6,50 @@
}
},
"response": {
"plans": [],
"meta": {
"pagination": {
"has_more": false,
"page": 0,
"per_page": 30
"plans": [
{
"oid": "plan_1",
"source_id": "123",
"source": "baremetrics",
"name": "Plan 1",
"interval": "year",
"interval_count": 1,
"trial_duration": null,
"trial_duration_unit": null,
"created": null,
"active": true,
"setup_fees": 0,
"amounts": [
{
"currency": "USD",
"symbol": "$",
"symbol_right": false,
"amount": 450000
}
]
},
{
"oid": "plan_2",
"source_id": "123",
"source": "baremetrics",
"name": "Plan 2",
"interval": "year",
"interval_count": 1,
"trial_duration": null,
"trial_duration_unit": null,
"created": null,
"active": true,
"setup_fees": 0,
"amounts": [
{
"currency": "USD",
"symbol": "$",
"symbol_right": false,
"amount": 450000
}
]
}
]
},
"response-headers": {
"X-TokenExpires": "0",

View file

@ -38,9 +38,13 @@ class TestBaremetricsBot(BotTestCase):
'baremetrics\nProvider ID: None\n\n')
def test_list_plans_command(self) -> None:
r = '**Listing plans:** \n1.Name: Plan 1\nActive: True\nInterval: year\nInterval Count: 1\nAmounts: \n' \
' - 450000 USD\n\n2.Name: Plan 2\nActive: True\nInterval: year\nInterval Count: 1\nAmounts: \n' \
' - 450000 USD\n\n'
with self.mock_config_info({'api_key': 'TEST'}):
with self.mock_http_conversation('list_plans'):
self.verify_reply('list-plans TEST', '**Listing plans:** \n')
self.verify_reply('list-plans TEST', r)
def test_list_customers_command(self) -> None:
with self.mock_config_info({'api_key': 'TEST'}):