Skip to content

Commit 9aaeec8

Browse files
author
Erick Sapp
committed
Added tests for SoftLayer/CLI/virt/reload.py
1 parent 7c8a1ce commit 9aaeec8

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

tests/CLI/modules/vs_tests.py

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ def test_rescue_vs(self, confirm_mock):
2323
self.assert_no_fail(result)
2424

2525
@mock.patch('SoftLayer.CLI.formatting.confirm')
26-
def test_rescue_no_confirm_vs(self, confirm_mock):
26+
def test_rescue_vs_no_confirm(self, confirm_mock):
2727
confirm_mock.return_value = False
2828
result = self.run_command(['vs', 'rescue', '100'])
2929

3030
self.assertEqual(result.exit_code, 2)
3131

3232
@mock.patch('SoftLayer.CLI.formatting.confirm')
33-
def test_reboot_default_vs(self, confirm_mock):
33+
def test_reboot_vs_default(self, confirm_mock):
3434
mock = self.set_mock('SoftLayer_Virtual_Guest', 'rebootDefault')
3535
mock.return_value = 'true'
3636
confirm_mock.return_value = True
@@ -39,7 +39,7 @@ def test_reboot_default_vs(self, confirm_mock):
3939
self.assert_no_fail(result)
4040

4141
@mock.patch('SoftLayer.CLI.formatting.confirm')
42-
def test_reboot_no_confirm_vs(self, confirm_mock):
42+
def test_reboot_vs_no_confirm(self, confirm_mock):
4343
mock = self.set_mock('SoftLayer_Virtual_Guest', 'rebootDefault')
4444
mock.return_value = 'true'
4545
confirm_mock.return_value = False
@@ -48,7 +48,7 @@ def test_reboot_no_confirm_vs(self, confirm_mock):
4848
self.assertEqual(result.exit_code, 2)
4949

5050
@mock.patch('SoftLayer.CLI.formatting.confirm')
51-
def test_reboot_soft_vs(self, confirm_mock):
51+
def test_reboot_vs_soft(self, confirm_mock):
5252
mock = self.set_mock('SoftLayer_Virtual_Guest', 'rebootSoft')
5353
mock.return_value = 'true'
5454
confirm_mock.return_value = True
@@ -58,7 +58,7 @@ def test_reboot_soft_vs(self, confirm_mock):
5858
self.assert_no_fail(result)
5959

6060
@mock.patch('SoftLayer.CLI.formatting.confirm')
61-
def test_reboot_hard_vs(self, confirm_mock):
61+
def test_reboot_vs_hard(self, confirm_mock):
6262
mock = self.set_mock('SoftLayer_Virtual_Guest', 'rebootHard')
6363
mock.return_value = 'true'
6464
confirm_mock.return_value = True
@@ -67,7 +67,7 @@ def test_reboot_hard_vs(self, confirm_mock):
6767
self.assert_no_fail(result)
6868

6969
@mock.patch('SoftLayer.CLI.formatting.confirm')
70-
def test_power_off_soft_vs(self, confirm_mock):
70+
def test_power_vs_off_soft(self, confirm_mock):
7171
mock = self.set_mock('SoftLayer_Virtual_Guest', 'powerOffSoft')
7272
mock.return_value = 'true'
7373
confirm_mock.return_value = True
@@ -77,7 +77,7 @@ def test_power_off_soft_vs(self, confirm_mock):
7777
self.assert_no_fail(result)
7878

7979
@mock.patch('SoftLayer.CLI.formatting.confirm')
80-
def test_power_off_no_confirm_vs(self, confirm_mock):
80+
def test_power_off_vs_no_confirm(self, confirm_mock):
8181
mock = self.set_mock('SoftLayer_Virtual_Guest', 'powerOffSoft')
8282
mock.return_value = 'true'
8383
confirm_mock.return_value = False
@@ -87,7 +87,7 @@ def test_power_off_no_confirm_vs(self, confirm_mock):
8787
self.assertEqual(result.exit_code, 2)
8888

8989
@mock.patch('SoftLayer.CLI.formatting.confirm')
90-
def test_power_off_hard_vs(self, confirm_mock):
90+
def test_power_off_vs_hard(self, confirm_mock):
9191
mock = self.set_mock('SoftLayer_Virtual_Guest', 'powerOff')
9292
mock.return_value = 'true'
9393
confirm_mock.return_value = True
@@ -117,7 +117,7 @@ def test_pause_vs(self, confirm_mock):
117117
self.assert_no_fail(result)
118118

119119
@mock.patch('SoftLayer.CLI.formatting.confirm')
120-
def test_pause_no_confirm_vs(self, confirm_mock):
120+
def test_pause_vs_no_confirm(self, confirm_mock):
121121
mock = self.set_mock('SoftLayer_Virtual_Guest', 'pause')
122122
mock.return_value = 'true'
123123
confirm_mock.return_value = False
@@ -153,7 +153,7 @@ def test_list_vs(self):
153153
'action': None,
154154
'id': 104,
155155
'backend_ip': '10.45.19.35'}])
156-
156+
157157
def test_detail_vs(self):
158158
result = self.run_command(['vs', 'detail', '100',
159159
'--passwords', '--price'])
@@ -783,3 +783,19 @@ def test_going_ready(self, _sleep):
783783
result = self.run_command(['vs', 'ready', '100', '--wait=100'])
784784
self.assert_no_fail(result)
785785
self.assertEqual(result.output, '"READY"\n')
786+
787+
@mock.patch('SoftLayer.CLI.formatting.no_going_back')
788+
def test_reload(self, confirm_mock):
789+
mock = self.set_mock('SoftLayer_Virtual_Guest', 'reloadCurrentOperatingSystemConfguration')
790+
confirm_mock.return_value = True
791+
792+
result = self.run_command(['vs', 'reload', '--postinstall', '100', '--key', '100', '--image', '100', '100'])
793+
self.assert_no_fail(result)
794+
795+
@mock.patch('SoftLayer.CLI.formatting.no_going_back')
796+
def test_reload_no_confirm(self, confirm_mock):
797+
mock = self.set_mock('SoftLayer_Virtual_Guest', 'reloadCurrentOperatingSystemConfiguration')
798+
confirm_mock.return_value = False
799+
800+
result = self.run_command(['vs', 'reload', '--postinstall', '100', '--key', '100', '--image', '100', '100'])
801+
self.assertEqual(result.exit_code, 2)

0 commit comments

Comments
 (0)