Skip to content

Commit 1e5afdc

Browse files
author
Brian Flores
committed
fix observations and unit tests
1 parent 3449733 commit 1e5afdc

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

SoftLayer/CLI/virt/detail.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,8 @@ def cli(env, identifier, passwords=False, price=False):
9898
'billingItem',
9999
'nextInvoiceTotalRecurringAmount') or 0
100100
if total_price != 0:
101-
price_data = _get_price_data(utils.lookup(result, 'billingItem'), total_price)
102-
table.add_row(['Prices', price_data['priceTable']])
103-
table.add_row(['Price rate', price_data['totalPrice']])
101+
table.add_row(['Prices', _price_table(utils.lookup(result, 'billingItem'), total_price)])
102+
table.add_row(['Price rate', total_price])
104103

105104
if passwords:
106105
pass_table = formatting.Table(['software', 'username', 'password'])
@@ -154,20 +153,15 @@ def _bw_table(bw_data):
154153
return table
155154

156155

157-
def _get_price_data(billing_item, total_price):
158-
"""Returns an item table and price rate value in an object"""
156+
def _price_table(billing_item, total_price):
157+
"""Returns an item table"""
159158
price_table = formatting.Table(['Item', 'CategoryCode', 'Recurring Price'])
160159
price_table.add_row(['Total', '-', total_price])
161160
items = billing_item['nextInvoiceChildren']
162161
for item in items:
163162
if item.get('recurringFee') is not None:
164-
total_price += float(item['recurringFee'])
165163
price_table.add_row([item['description'], item['categoryCode'], item['recurringFee']])
166-
response = {
167-
"priceTable": price_table,
168-
"totalPrice": total_price,
169-
}
170-
return response
164+
return price_table
171165

172166

173167
def _cli_helper_dedicated_host(env, result, table):

SoftLayer/fixtures/SoftLayer_Virtual_Guest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"oneTimeFeeTaxRate": "0",
8080
"orderItemId": None,
8181
"parentId": None,
82-
"recurringFee": "59.52",
82+
"recurringFee": "1.54",
8383
"recurringFeeTaxRate": "0",
8484
"recurringMonths": 1,
8585
"serviceProviderId": 1,

tests/CLI/modules/vs/vs_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def test_detail_vs(self):
167167
self.assert_no_fail(result)
168168
output = json.loads(result.output)
169169
self.assertEqual(output['notes'], 'notes')
170-
self.assertEqual(output['Price rate'], 61.06)
170+
self.assertEqual(output['Price rate'], 1.54)
171171
self.assertEqual(output['users'][0]['username'], 'user')
172172
self.assertEqual(output['vlans'][0]['number'], 23)
173173
self.assertEqual(output['owner'], 'chechu')

0 commit comments

Comments
 (0)