|
4 | 4 |
|
5 | 5 | :license: MIT, see LICENSE for more details. |
6 | 6 | """ |
| 7 | +from SoftLayer import exceptions |
7 | 8 | from SoftLayer import testing |
8 | 9 |
|
9 | 10 | import json |
@@ -94,6 +95,31 @@ def test_volume_cancel(self): |
94 | 95 | self.assert_called_with('SoftLayer_Billing_Item', 'cancelItem', |
95 | 96 | args=(False, True, None)) |
96 | 97 |
|
| 98 | + def test_volume_cancel_with_billing_item(self): |
| 99 | + result = self.run_command([ |
| 100 | + '--really', 'file', 'volume-cancel', '1234']) |
| 101 | + |
| 102 | + self.assert_no_fail(result) |
| 103 | + self.assertEqual('File volume with id 1234 has been marked' |
| 104 | + ' for cancellation\n', result.output) |
| 105 | + self.assert_called_with('SoftLayer_Network_Storage', 'getObject') |
| 106 | + |
| 107 | + def test_volume_cancel_without_billing_item(self): |
| 108 | + p_mock = self.set_mock('SoftLayer_Network_Storage', 'getObject') |
| 109 | + p_mock.return_value = { |
| 110 | + "accountId": 1234, |
| 111 | + "capacityGb": 20, |
| 112 | + "createDate": "2015-04-29T06:55:55-07:00", |
| 113 | + "id": 11111, |
| 114 | + "nasType": "NAS", |
| 115 | + "username": "SL01SEV307608_1" |
| 116 | + } |
| 117 | + |
| 118 | + result = self.run_command([ |
| 119 | + '--really', 'file', 'volume-cancel', '1234']) |
| 120 | + |
| 121 | + self.assertIsInstance(result.exception, exceptions.SoftLayerError) |
| 122 | + |
97 | 123 | def test_volume_detail(self): |
98 | 124 | result = self.run_command(['file', 'volume-detail', '1234']) |
99 | 125 |
|
|
0 commit comments