88import sys
99import unittest
1010
11- from SoftLayer .CLI import exceptions
12-
1311from SoftLayer .fixtures import SoftLayer_User_Customer
1412from SoftLayer import testing
1513from unittest import mock as mock
@@ -418,8 +416,7 @@ def test_refresh_api_authentication_key(self):
418416 result = self .run_command (['user' , 'apikey' , '123456' , '--refresh' ])
419417 self .assert_no_fail (result )
420418
421- @mock .patch ('SoftLayer.CLI.formatting.confirm' )
422- def test_vpn_disable (self , confirm_mock ):
419+ def test_vpn_disable (self ):
423420 result = self .run_command (['user' , 'vpn-disable' , '8344458' ])
424421 self .assert_no_fail (result )
425422 self .assert_called_with ('SoftLayer_User_Customer' , 'editObject' , identifier = 8344458 )
@@ -431,8 +428,14 @@ def test_vpn_disable(self, confirm_mock):
431428 self .assert_called_with ('SoftLayer_User_Customer' , 'editObject' , identifier = 8344458 )
432429 self .assertEqual ('8344458 vpn is successfully disabled\n ' , result .output )
433430
434- confirm_mock .return_value = False
435- result = self .run_command (['user' , 'vpn-disable' , '8344458' ])
431+ def test_vpn_enable (self ):
432+ result = self .run_command (['user' , 'vpn-enable' , '8344458' ])
433+ self .assert_no_fail (result )
434+ self .assert_called_with ('SoftLayer_User_Customer' , 'editObject' , identifier = 8344458 )
436435
437- self .assertEqual (result .exit_code , 2 )
438- self .assertIsInstance (result .exception , exceptions .CLIAbort )
436+ result = self .run_command (['user' , 'vpn-enable' , '8344458' ])
437+ permission_m = self .set_mock ('SoftLayer_User_Customer' , 'editObject' )
438+ permission_m .return_value = {'sslVpnAllowedFlag' : True }
439+ self .assert_no_fail (result )
440+ self .assert_called_with ('SoftLayer_User_Customer' , 'editObject' , identifier = 8344458 )
441+ self .assertEqual ('8344458 vpn is successfully enabled\n ' , result .output )
0 commit comments