@@ -39,8 +39,7 @@ def test_ip_cancel(self, no_going_back_mock):
3939 no_going_back_mock .return_value = False
4040 result = self .run_command (['globalip' , 'cancel' , '1' ])
4141
42- self .assertEqual (result .exit_code , 2 )
43- self .assertIsInstance (result .exception , exceptions .CLIAbort )
42+ self .assertEqual (result .exit_code , 0 )
4443
4544 def test_ip_list (self ):
4645 result = self .run_command (['globalip' , 'list' , '--ip-version=v4' ])
@@ -85,3 +84,27 @@ def test_ip_unassign(self):
8584 result = self .run_command (['globalip' , 'unassign' , '1' ])
8685 self .assert_no_fail (result )
8786 self .assertEqual (result .output , "" )
87+
88+ def test_ip_cancel_force (self ):
89+ result = self .run_command (['globalip' , 'cancel' , '1' , '--force' ])
90+
91+ self .assert_no_fail (result )
92+ self .assertEqual (result .exit_code , 0 )
93+
94+ @mock .patch ('SoftLayer.CLI.formatting.confirm' )
95+ def test_ip_cancel_no_abort (self , confirm_mock ):
96+ # Test with confirmation and responding negatively
97+ confirm_mock .return_value = True
98+ result = self .run_command (['globalip' , 'cancel' , '1' ])
99+
100+ self .assert_no_fail (result )
101+ self .assertEqual (result .exit_code , 0 )
102+
103+ @mock .patch ('SoftLayer.CLI.formatting.confirm' )
104+ def test_ip_cancel_abort (self , confirm_mock ):
105+ # Test with confirmation and responding negatively
106+ confirm_mock .return_value = False
107+ result = self .run_command (['globalip' , 'cancel' , '1' ])
108+
109+ self .assertEqual (result .exit_code , 2 )
110+ self .assertIsInstance (result .exception , exceptions .CLIAbort )
0 commit comments