Skip to content

Commit caa096f

Browse files
committed
#1545 add test to validate cli account event json output
1 parent 6b17d25 commit caa096f

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

tests/CLI/modules/account_tests.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
55
Tests for the user cli command
66
"""
7+
import json
8+
79
from SoftLayer.fixtures import SoftLayer_Account as SoftLayer_Account
810
from SoftLayer import testing
911

@@ -37,8 +39,20 @@ def test_event_ack_all(self):
3739
self.assert_called_with(self.SLNOE, 'getAllObjects')
3840
self.assert_called_with(self.SLNOE, 'acknowledgeNotification', identifier=1234)
3941

40-
# slcli account invoice-detail
42+
def test_event_jsonraw_output(self):
43+
# https://github.com/softlayer/softlayer-python/issues/1545
44+
command = '--format jsonraw account events'
45+
command_params = command.split()
46+
result = self.run_command(command_params)
47+
json_text_tables = result.stdout.split('\n')
48+
# removing an extra item due to an additional Newline at the end of the output
49+
json_text_tables.pop()
50+
# each item in the json_text_tables should be a list
51+
for json_text_table in json_text_tables:
52+
json_table = json.loads(json_text_table)
53+
self.assertIsInstance(json_table, list)
4154

55+
# slcli account invoice-detail
4256
def test_invoice_detail(self):
4357
result = self.run_command(['account', 'invoice-detail', '1234'])
4458
self.assert_no_fail(result)

0 commit comments

Comments
 (0)