@@ -40,47 +40,37 @@ def test_list_endpoints(self):
4040 'public' : 'https://dal05/auth/v1.0/' }])
4141
4242 def test_create_credential (self ):
43- accounts = self .set_mock ('SoftLayer_Network_Storage_Hub_Cleversafe_Account' , 'credentialCreate' )
44- accounts .return_value = {
45- "accountId" : "12345" ,
46- "createDate" : "2019-04-05T13:25:25-06:00" ,
47- "id" : 11111 ,
48- "password" : "nwUEUsx6PiEoN0B1Xe9z9hUCy" ,
49- "username" : "XfHhBNBPlPdl" ,
50- "type" : {
51- "description" : "A credential for generating S3 Compatible Signatures." ,
52- "keyName" : "S3_COMPATIBLE_SIGNATURE" ,
53- "name" : "S3 Compatible Signature"
54- }
55- }
56-
5743 result = self .run_command (['object-storage' , 'credential' , 'create' , '100' ])
44+ self .assert_no_fail (result )
5845
46+ @mock .patch ('SoftLayer.CLI.helpers.resolve_id' )
47+ def test_create_credential_by_username (self , resolve_id_mock ):
48+ resolve_id_mock .return_value = 100
49+ result = self .run_command (['object-storage' , 'credential' , 'create' , 'test' ])
5950 self .assert_no_fail (result )
60- self .assertEqual (json .loads (result .output ),
61- [{'id' : 11111 ,
62- 'password' : 'nwUEUsx6PiEoN0B1Xe9z9hUCy' ,
63- 'type_name' : 'S3 Compatible Signature' ,
64- 'username' : 'XfHhBNBPlPdl' }]
65- )
6651
6752 def test_delete_credential (self ):
68- accounts = self .set_mock ('SoftLayer_Network_Storage_Hub_Cleversafe_Account' , 'credentialDelete' )
69- accounts .return_value = True
70-
7153 result = self .run_command (['object-storage' , 'credential' , 'delete' , '-c' , 100 , '100' ])
72-
7354 self .assert_no_fail (result )
7455 self .assertEqual (result .output , 'True\n ' )
7556
76- def test_limit_credential (self ):
77- accounts = self .set_mock ('SoftLayer_Network_Storage_Hub_Cleversafe_Account' , 'getCredentialLimit' )
78- accounts .return_value = 2
57+ @mock .patch ('SoftLayer.CLI.helpers.resolve_id' )
58+ def test_delete_credential_by_username (self , resolve_id_mock ):
59+ resolve_id_mock .return_value = 100
60+ result = self .run_command (['object-storage' , 'credential' , 'delete' , 'test' ])
61+ self .assert_no_fail (result )
7962
63+ def test_limit_credential (self ):
8064 result = self .run_command (['object-storage' , 'credential' , 'limit' , '100' ])
8165
8266 self .assert_no_fail (result )
83- self .assertEqual (json .loads (result .output ), [{'limit' : 2 }])
67+ self .assertIn ('limit' , result .output )
68+
69+ @mock .patch ('SoftLayer.CLI.helpers.resolve_id' )
70+ def test_limit_credential_by_username (self , resolve_id_mock ):
71+ resolve_id_mock .return_value = 100
72+ result = self .run_command (['object-storage' , 'credential' , 'limit' , 'test' ])
73+ self .assert_no_fail (result )
8474
8575 def test_list_credential (self ):
8676 result = self .run_command (['object-storage' , 'credential' , 'list' , '100' ])
0 commit comments