Skip to content

Commit acde527

Browse files
Add a unit test to avoid storage username ex.
1 parent 605cab1 commit acde527

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/CLI/modules/server_tests.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,16 @@ def test_authorize_hw_no_confirm(self, confirm_mock):
910910
result = self.run_command(['hw', 'authorize-storage', '-u', '1234'])
911911

912912
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")
913923

914924
def test_authorize_hw(self):
915925
result = self.run_command(['hw', 'authorize-storage', '--username-storage=SL01SEL301234-11', '1234'])

0 commit comments

Comments
 (0)