@@ -37,3 +37,70 @@ def test_list_endpoints(self):
3737 [{'datacenter' : 'dal05' ,
3838 'private' : 'https://dal05/auth/v1.0/' ,
3939 'public' : 'https://dal05/auth/v1.0/' }])
40+
41+ def test_create_credential (self ):
42+ accounts = self .set_mock ('SoftLayer_Network_Storage_Hub_Cleversafe_Account' , 'credentialCreate' )
43+ accounts .return_value = {
44+ "accountId" : "12345" ,
45+ "createDate" : "2019-04-05T13:25:25-06:00" ,
46+ "id" : 11111 ,
47+ "password" : "nwUEUsx6PiEoN0B1Xe9z9hUCy" ,
48+ "username" : "XfHhBNBPlPdl" ,
49+ "type" : {
50+ "description" : "A credential for generating S3 Compatible Signatures." ,
51+ "keyName" : "S3_COMPATIBLE_SIGNATURE" ,
52+ "name" : "S3 Compatible Signature"
53+ }
54+ }
55+
56+ result = self .run_command (['object-storage' , 'credential' , 'create' , '100' ])
57+
58+ self .assert_no_fail (result )
59+ self .assertEqual (json .loads (result .output ),
60+ [{'id' : 11111 ,
61+ 'password' : 'nwUEUsx6PiEoN0B1Xe9z9hUCy' ,
62+ 'type_name' : 'S3 Compatible Signature' ,
63+ 'username' : 'XfHhBNBPlPdl' }]
64+ )
65+
66+ def test_delete_credential (self ):
67+ accounts = self .set_mock ('SoftLayer_Network_Storage_Hub_Cleversafe_Account' , 'credentialDelete' )
68+ accounts .return_value = True
69+
70+ result = self .run_command (['object-storage' , 'credential' , 'delete' , '-c' , 100 , '100' ])
71+
72+ self .assert_no_fail (result )
73+ self .assertEqual (result .output , 'True\n ' )
74+
75+ def test_limit_credential (self ):
76+ accounts = self .set_mock ('SoftLayer_Network_Storage_Hub_Cleversafe_Account' , 'getCredentialLimit' )
77+ accounts .return_value = 2
78+
79+ result = self .run_command (['object-storage' , 'credential' , 'limit' , '100' ])
80+
81+ self .assert_no_fail (result )
82+ self .assertEqual (json .loads (result .output ), [{'limit' : 2 }])
83+
84+ def test_list_credential (self ):
85+ accounts = self .set_mock ('SoftLayer_Network_Storage_Hub_Cleversafe_Account' , 'getCredentials' )
86+ accounts .return_value = [{'id' : 1103123 ,
87+ 'password' : 'nwUEUsx6PiEoN0B1Xe9z9hUCyXM' ,
88+ 'type' : {'name' : 'S3 Compatible Signature' },
89+ 'username' : 'XfHhBNBPlPdlWya' },
90+ {'id' : 1103333 ,
91+ 'password' : 'nwUEUsx6PiEoN0B1Xe9z9' ,
92+ 'type' : {'name' : 'S3 Compatible Signature' },
93+ 'username' : 'XfHhBNBPlPd' }]
94+
95+ result = self .run_command (['object-storage' , 'credential' , 'list' , '100' ])
96+
97+ self .assert_no_fail (result )
98+ self .assertEqual (json .loads (result .output ),
99+ [{'id' : 1103123 ,
100+ 'password' : 'nwUEUsx6PiEoN0B1Xe9z9hUCyXM' ,
101+ 'type_name' : 'S3 Compatible Signature' ,
102+ 'username' : 'XfHhBNBPlPdlWya' },
103+ {'id' : 1103333 ,
104+ 'password' : 'nwUEUsx6PiEoN0B1Xe9z9' ,
105+ 'type_name' : 'S3 Compatible Signature' ,
106+ 'username' : 'XfHhBNBPlPd' }])
0 commit comments