Skip to content

Commit a723d16

Browse files
Merge pull request #1564 from caberos/issue1562
Add Item names to vs billing report
2 parents d448cf3 + f6677a7 commit a723d16

File tree

4 files changed

+53
-38
lines changed

4 files changed

+53
-38
lines changed

SoftLayer/CLI/virt/billing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ def cli(env, identifier):
2828
table.add_row(['Billing Item Id', utils.lookup(result, 'billingItem', 'id')])
2929
table.add_row(['Recurring Fee', utils.lookup(result, 'billingItem', 'recurringFee')])
3030
table.add_row(['Total', utils.lookup(result, 'billingItem', 'nextInvoiceTotalRecurringAmount')])
31-
table.add_row(['Provision Date', utils.lookup(result, 'billingItem', 'provisionDate')])
31+
table.add_row(['Provision Date', utils.lookup(result, 'provisionDate')])
3232

33-
price_table = formatting.Table(['Recurring Price'])
33+
price_table = formatting.Table(['Description', 'Recurring Price'])
3434
for item in utils.lookup(result, 'billingItem', 'children') or []:
35-
price_table.add_row([item['nextInvoiceTotalRecurringAmount']])
35+
price_table.add_row([item['description'], item['nextInvoiceTotalRecurringAmount']])
3636

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

SoftLayer/fixtures/SoftLayer_Virtual_Guest.py

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,31 @@
88
'id': 6327,
99
'nextInvoiceTotalRecurringAmount': 1.54,
1010
'children': [
11-
{'categoryCode': 'port_speed',
12-
'nextInvoiceTotalRecurringAmount': 1},
13-
{'categoryCode': 'guest_core',
14-
'nextInvoiceTotalRecurringAmount': 1},
15-
{'categoryCode': 'ram',
16-
'nextInvoiceTotalRecurringAmount': 1},
17-
{'categoryCode': 'guest_core',
18-
'nextInvoiceTotalRecurringAmount': 1},
19-
{'categoryCode': 'guest_disk1',
20-
'nextInvoiceTotalRecurringAmount': 1},
11+
{
12+
'categoryCode': 'ram',
13+
'description': '1 GB',
14+
'nextInvoiceTotalRecurringAmount': 1
15+
},
16+
{
17+
'categoryCode': 'remote_management',
18+
'description': 'Reboot / Remote Console',
19+
'nextInvoiceTotalRecurringAmount': 1
20+
},
21+
{
22+
'categoryCode': 'port_speed',
23+
'description': '1 Gbps Public & Private Network Uplinks',
24+
'nextInvoiceTotalRecurringAmount': 1
25+
},
26+
{
27+
'categoryCode': 'public_port',
28+
'description': '1 Gbps Public Uplink',
29+
'nextInvoiceTotalRecurringAmount': 1
30+
},
31+
{
32+
'categoryCode': 'service_port',
33+
'description': '1 Gbps Private Uplink',
34+
'nextInvoiceTotalRecurringAmount': 1
35+
}
2136
],
2237
'package': {
2338
"id": 835,

SoftLayer/managers/vs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def get_instance(self, instance_id, **kwargs):
245245
'userData,'
246246
'''billingItem[id,nextInvoiceTotalRecurringAmount,
247247
package[id,keyName],
248-
children[categoryCode,nextInvoiceTotalRecurringAmount],
248+
children[description,categoryCode,nextInvoiceTotalRecurringAmount],
249249
orderItem[id,
250250
order.userRecord[username],
251251
preset.keyName]],'''

tests/CLI/modules/vs/vs_tests.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ def test_create_options_prices(self):
323323

324324
def test_create_options_prices_location(self):
325325
result = self.run_command(['vs', 'create-options', '--prices', 'dal13',
326-
'--vsi-type', 'TRANSIENT_CLOUD_SERVER'])
326+
'--vsi-type', 'TRANSIENT_CLOUD_SERVER'])
327327
self.assert_no_fail(result)
328328

329329
@mock.patch('SoftLayer.CLI.formatting.confirm')
@@ -345,19 +345,19 @@ def test_dns_sync_both(self, confirm_mock):
345345
'getResourceRecords')
346346
getResourceRecords.return_value = []
347347
createAargs = ({
348-
'type': 'a',
349-
'host': 'vs-test1',
350-
'domainId': 12345, # from SoftLayer_Account::getDomains
351-
'data': '172.16.240.2',
352-
'ttl': 7200
353-
},)
348+
'type': 'a',
349+
'host': 'vs-test1',
350+
'domainId': 12345, # from SoftLayer_Account::getDomains
351+
'data': '172.16.240.2',
352+
'ttl': 7200
353+
},)
354354
createPTRargs = ({
355-
'type': 'ptr',
356-
'host': '2',
357-
'domainId': 123456,
358-
'data': 'vs-test1.test.sftlyr.ws',
359-
'ttl': 7200
360-
},)
355+
'type': 'ptr',
356+
'host': '2',
357+
'domainId': 123456,
358+
'data': 'vs-test1.test.sftlyr.ws',
359+
'ttl': 7200
360+
},)
361361

362362
result = self.run_command(['vs', 'dns-sync', '100'])
363363

@@ -400,12 +400,12 @@ def test_dns_sync_v6(self, confirm_mock):
400400
}
401401
}
402402
createV6args = ({
403-
'type': 'aaaa',
404-
'host': 'vs-test1',
405-
'domainId': 12345,
406-
'data': '2607:f0d0:1b01:0023:0000:0000:0000:0004',
407-
'ttl': 7200
408-
},)
403+
'type': 'aaaa',
404+
'host': 'vs-test1',
405+
'domainId': 12345,
406+
'data': '2607:f0d0:1b01:0023:0000:0000:0000:0004',
407+
'ttl': 7200
408+
},)
409409
guest.return_value = test_guest
410410
result = self.run_command(['vs', 'dns-sync', '--aaaa-record', '100'])
411411
self.assert_no_fail(result)
@@ -822,11 +822,11 @@ def test_billing(self):
822822
'Recurring Fee': None,
823823
'Total': 1.54,
824824
'prices': [
825-
{'Recurring Price': 1},
826-
{'Recurring Price': 1},
827-
{'Recurring Price': 1},
828-
{'Recurring Price': 1},
829-
{'Recurring Price': 1}
825+
{'Description': '1 GB', 'Recurring Price': 1},
826+
{'Description': 'Reboot / Remote Console', 'Recurring Price': 1},
827+
{'Description': '1 Gbps Public & Private Network Uplinks', 'Recurring Price': 1},
828+
{'Description': '1 Gbps Public Uplink', 'Recurring Price': 1},
829+
{'Description': '1 Gbps Private Uplink', 'Recurring Price': 1}
830830
]
831831
}
832832
self.assert_no_fail(result)

0 commit comments

Comments
 (0)