Skip to content

Commit 68f46e2

Browse files
author
caberos
committed
fix tox Christopher commet code review
1 parent d149472 commit 68f46e2

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

SoftLayer/managers/vs.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,11 @@ def upgrade(self, instance_id, cpus=None, memory=None, nic_speed=None, public=Tr
883883
public)
884884
disk_number = disk_number + 1
885885

886+
if price_id is None:
887+
raise exceptions.SoftLayerAPIError(500,
888+
'Unable to find %s option with value %s' % (
889+
('disk', disk_guest.get('capacity'))))
890+
886891
category = {'categories': [{
887892
'categoryCode': 'guest_disk' + str(disk_number),
888893
'complexType': "SoftLayer_Product_Item_Category"}],

tests/CLI/modules/vs/vs_tests.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,14 @@ def test_upgrade_disk(self, confirm_mock):
583583
self.assertIn({'id': 100}, order_container['virtualGuests'])
584584
self.assertEqual(order_container['virtualGuests'], [{'id': 100}])
585585

586+
@mock.patch('SoftLayer.CLI.formatting.confirm')
587+
def test_upgrade_disk_error(self, confirm_mock):
588+
confirm_mock.return_value = True
589+
result = self.run_command(['vs', 'upgrade', '100', '--flavor=M1_64X512X100',
590+
'--resize-disk=1000', '1', '--resize-disk=10', '2'])
591+
self.assertEqual(result.exit_code, 1)
592+
self.assertIsInstance(result.exception, SoftLayerAPIError)
593+
586594
@mock.patch('SoftLayer.CLI.formatting.confirm')
587595
def test_upgrade_with_flavor(self, confirm_mock):
588596
confirm_mock.return_value = True

0 commit comments

Comments
 (0)