Skip to content

Commit 94ca347

Browse files
Merge pull request #1556 from ATGE/issues/1555-hw-billing
Fix hw billing reports 0 items
2 parents 98feac7 + b3d28a2 commit 94ca347

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

SoftLayer/CLI/hardware/billing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def cli(env, identifier):
3131
table.add_row(['Provision Date', utils.lookup(result, 'billingItem', 'provisionDate')])
3232

3333
price_table = formatting.Table(['Item', 'Recurring Price'])
34-
for item in utils.lookup(result, 'billingItem', 'children') or []:
34+
for item in utils.lookup(result, 'billingItem', 'nextInvoiceChildren') or []:
3535
price_table.add_row([item['description'], item['nextInvoiceTotalRecurringAmount']])
3636

3737
table.add_row(['prices', price_table])

tests/CLI/modules/server_tests.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -868,19 +868,25 @@ def test_hardware_storage(self):
868868

869869
def test_billing(self):
870870
result = self.run_command(['hw', 'billing', '123456'])
871-
billing_json = {
871+
hardware_server_billing = {
872872
'Billing Item Id': 6327,
873873
'Id': '123456',
874874
'Provision Date': None,
875875
'Recurring Fee': 1.54,
876876
'Total': 16.08,
877-
'prices': [{
878-
'Item': 'test',
879-
'Recurring Price': 1
880-
}]
877+
'prices': [
878+
{
879+
'Item': 'test',
880+
'Recurring Price': 1
881+
},
882+
{
883+
'Item': 'test2',
884+
'Recurring Price': 2
885+
},
886+
]
881887
}
882888
self.assert_no_fail(result)
883-
self.assertEqual(json.loads(result.output), billing_json)
889+
self.assertEqual(json.loads(result.output), hardware_server_billing)
884890

885891
@mock.patch('SoftLayer.CLI.formatting.confirm')
886892
def test_create_hw_no_confirm(self, confirm_mock):

0 commit comments

Comments
 (0)