@@ -904,6 +904,27 @@ def test_hardware_guests_empty(self):
904904 self .assertEqual (result .exit_code , 2 )
905905 self .assertIsInstance (result .exception , exceptions .CLIAbort )
906906
907+ @mock .patch ('SoftLayer.CLI.formatting.confirm' )
908+ def test_authorize_hw_no_confirm (self , confirm_mock ):
909+ confirm_mock .return_value = False
910+ result = self .run_command (['hw' , 'authorize-storage' , '-u' , '1234' ])
911+
912+ self .assertEqual (result .exit_code , 2 )
913+
914+ @mock .patch ('SoftLayer.CLI.formatting.confirm' )
915+ def test_authorize_hw_empty (self , confirm_mock ):
916+ confirm_mock .return_value = True
917+ storage_result = self .set_mock ('SoftLayer_Account' , 'getNetworkStorage' )
918+ storage_result .return_value = []
919+ result = self .run_command (['hw' , 'authorize-storage' , '--username-storage=#' , '1234' ])
920+
921+ self .assertEqual (str (result .exception ), "The Storage with username: # was not found, "
922+ "please enter a valid storage username" )
923+
924+ def test_authorize_hw (self ):
925+ result = self .run_command (['hw' , 'authorize-storage' , '--username-storage=SL01SEL301234-11' , '1234' ])
926+ self .assert_no_fail (result )
927+
907928 def test_upgrade_no_options (self , ):
908929 result = self .run_command (['hw' , 'upgrade' , '100' ])
909930 self .assertEqual (result .exit_code , 2 )
@@ -928,4 +949,5 @@ def test_upgrade(self, confirm_mock):
928949 confirm_mock .return_value = True
929950 result = self .run_command (['hw' , 'upgrade' , '100' , '--memory=32' , '--public-bandwidth=500' ,
930951 '--drive-controller=RAID' , '--network=10000 Redundant' ])
952+
931953 self .assert_no_fail (result )
0 commit comments