Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixes for slcli globalip tests
  • Loading branch information
J Jayasilan authored and J Jayasilan committed Jul 28, 2023
1 parent 2119b84 commit 2d0f9f7
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions tests/CLI/modules/globalip_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ def test_ip_cancel(self, no_going_back_mock):
no_going_back_mock.return_value = False
result = self.run_command(['globalip', 'cancel', '1'])

self.assertEqual(result.exit_code, 2)
self.assertIsInstance(result.exception, exceptions.CLIAbort)
self.assertEqual(result.exit_code, 0)

def test_ip_list(self):
result = self.run_command(['globalip', 'list', '--ip-version=v4'])
Expand Down Expand Up @@ -85,3 +84,27 @@ def test_ip_unassign(self):
result = self.run_command(['globalip', 'unassign', '1'])
self.assert_no_fail(result)
self.assertEqual(result.output, "")

def test_ip_cancel_force(self):
result = self.run_command(['globalip', 'cancel', '1', '--force'])

self.assert_no_fail(result)
self.assertEqual(result.exit_code, 0)

@mock.patch('SoftLayer.CLI.formatting.confirm')
def test_ip_cancel_no_abort(self, confirm_mock):
# Test with confirmation and responding negatively
confirm_mock.return_value = True
result = self.run_command(['globalip', 'cancel', '1'])

self.assert_no_fail(result)
self.assertEqual(result.exit_code, 0)

@mock.patch('SoftLayer.CLI.formatting.confirm')
def test_ip_cancel_abort(self, confirm_mock):
# Test with confirmation and responding negatively
confirm_mock.return_value = False
result = self.run_command(['globalip', 'cancel', '1'])

self.assertEqual(result.exit_code, 2)
self.assertIsInstance(result.exception, exceptions.CLIAbort)

0 comments on commit 2d0f9f7

Please sign in to comment.