|
4 | 4 |
|
5 | 5 | :license: MIT, see LICENSE for more details. |
6 | 6 | """ |
| 7 | +import mock |
| 8 | + |
7 | 9 | from SoftLayer import testing |
8 | 10 |
|
9 | 11 |
|
@@ -76,3 +78,19 @@ def test_detail_hardware_without_hostname(self): |
76 | 78 | vlan_mock.return_value = getObject |
77 | 79 | result = self.run_command(['vlan', 'detail', '1234']) |
78 | 80 | self.assert_no_fail(result) |
| 81 | + |
| 82 | + @mock.patch('SoftLayer.CLI.vlan.edit.click') |
| 83 | + def test_vlan_edit(self, click): |
| 84 | + result = self.run_command(['vlan', 'edit', '--name=nameTest', '--note=noteTest', '--tags=tag1,tag2', '100']) |
| 85 | + click.secho.assert_called_with('Vlan edited successfully', fg='green') |
| 86 | + self.assert_no_fail(result) |
| 87 | + self.assert_called_with('SoftLayer_Network_Vlan', 'editObject', identifier=100) |
| 88 | + |
| 89 | + @mock.patch('SoftLayer.CLI.vlan.edit.click') |
| 90 | + def test_vlan_edit_failure(self, click): |
| 91 | + mock = self.set_mock('SoftLayer_Network_Vlan', 'editObject') |
| 92 | + mock.return_value = False |
| 93 | + result = self.run_command(['vlan', 'edit', '--name=nameTest', '--note=noteTest', '--tags=tag1,tag2', '100']) |
| 94 | + click.secho.assert_called_with('Failed to edit the vlan', fg='red') |
| 95 | + self.assert_no_fail(result) |
| 96 | + self.assert_called_with('SoftLayer_Network_Vlan', 'editObject', identifier=100) |
0 commit comments