Skip to content

Commit b07176e

Browse files
Merge pull request #1546 from ATGE/issues/1545-account-events
Fix account events
2 parents 00c62ac + caa096f commit b07176e

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

SoftLayer/CLI/account/events.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ def unplanned_event_table(events):
6969
unplanned_table.align['Subject'] = 'l'
7070
unplanned_table.align['Impacted Resources'] = 'l'
7171
for event in events:
72-
print(event.get('modifyDate'))
7372
unplanned_table.add_row([
7473
event.get('id'),
7574
event.get('systemTicketId'),

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)