1414
1515
1616class UserCLITests (testing .TestCase ):
17-
1817 """User list tests"""
1918
2019 def test_user_list (self ):
@@ -153,6 +152,7 @@ def test_edit_perms_from_user(self):
153152 self .assert_called_with ('SoftLayer_User_Customer' , 'addBulkPortalPermission' , identifier = 11100 )
154153
155154 """User create tests"""
155+
156156 @mock .patch ('SoftLayer.CLI.formatting.confirm' )
157157 def test_create_user (self , confirm_mock ):
158158 confirm_mock .return_value = True
@@ -228,6 +228,7 @@ def test_create_user_from_user(self, confirm_mock):
228228 self .assert_called_with ('SoftLayer_User_Customer' , 'getObject' , identifier = 1234 )
229229
230230 """User edit-details tests"""
231+
231232 @mock .patch ('SoftLayer.CLI.user.edit_details.click' )
232233 def test_edit_details (self , click ):
233234 result = self .run_command (['user' , 'edit-details' , '1234' , '-t' , '{"firstName":"Supermand"}' ])
@@ -252,6 +253,7 @@ def test_edit_details_bad_json(self):
252253 self .assertEqual (result .exit_code , 2 )
253254
254255 """User delete tests"""
256+
255257 @mock .patch ('SoftLayer.CLI.user.delete.click' )
256258 def test_delete (self , click ):
257259 result = self .run_command (['user' , 'delete' , '12345' ])
@@ -269,3 +271,37 @@ def test_delete_failure(self, click):
269271 self .assert_no_fail (result )
270272 self .assert_called_with ('SoftLayer_User_Customer' , 'editObject' ,
271273 args = ({'userStatusId' : 1021 },), identifier = 12345 )
274+
275+ """User vpn manual config tests"""
276+
277+ @mock .patch ('SoftLayer.CLI.user.vpn_manual.click' )
278+ def test_vpn_manual (self , click ):
279+ result = self .run_command (['user' , 'vpn-manual' , '12345' , '--enable' ])
280+ click .secho .assert_called_with ('12345 vpn manual config enable' , fg = 'green' )
281+ self .assert_no_fail (result )
282+
283+ def test_vpn_manual_fail (self ):
284+ mock = self .set_mock ('SoftLayer_User_Customer' , 'editObject' )
285+ mock .return_value = False
286+ result = self .run_command (['user' , 'vpn-manual' , '12345' , '--enable' ])
287+ self .assert_no_fail (result )
288+
289+ """User vpn subnet tests"""
290+
291+ @mock .patch ('SoftLayer.CLI.user.vpn_subnet.click' )
292+ def test_vpn_subnet_add (self , click ):
293+ result = self .run_command (['user' , 'vpn-subnet' , '12345' , '--add' , '1234' ])
294+ click .secho .assert_called_with ('12345 updated successfully' , fg = 'green' )
295+ self .assert_no_fail (result )
296+
297+ def test_vpn_subnet_add_fail (self ):
298+ mock = self .set_mock ('SoftLayer_Network_Service_Vpn_Overrides' , 'createObjects' )
299+ mock .return_value = False
300+ result = self .run_command (['user' , 'vpn-subnet' , '12345' , '--add' , '1234' ])
301+ self .assert_no_fail (result )
302+
303+ @mock .patch ('SoftLayer.CLI.user.vpn_subnet.click' )
304+ def test_vpn_subnet_remove (self , click ):
305+ result = self .run_command (['user' , 'vpn-subnet' , '12345' , '--remove' , '1234' ])
306+ click .secho .assert_called_with ('12345 updated successfully' , fg = 'green' )
307+ self .assert_no_fail (result )
0 commit comments