@@ -70,6 +70,75 @@ def test_object_create_container_single(self):
7070 )]
7171 self .assertEqual (datalist , list (data ))
7272
73+ def test_object_create_container_storage_policy (self ):
74+ self .requests_mock .register_uri (
75+ 'PUT' ,
76+ object_fakes .ENDPOINT + '/ernie' ,
77+ headers = {
78+ 'x-trans-id' : '314159' ,
79+ 'x-storage-policy' : 'o1--sr-r3'
80+ },
81+ status_code = 200 ,
82+ )
83+
84+ arglist = [
85+ 'ernie' ,
86+ '--storage-policy' ,
87+ 'o1--sr-r3'
88+ ]
89+ verifylist = [
90+ ('containers' , ['ernie' ]),
91+ ('storage_policy' , 'o1--sr-r3' )
92+ ]
93+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
94+
95+ # In base command class ShowOne in cliff, abstract method take_action()
96+ # returns a two-part tuple with a tuple of column names and a tuple of
97+ # data to be shown.
98+ columns , data = self .cmd .take_action (parsed_args )
99+
100+ self .assertEqual (self .columns , columns )
101+ datalist = [(
102+ object_fakes .ACCOUNT_ID ,
103+ 'ernie' ,
104+ '314159' ,
105+ )]
106+ self .assertEqual (datalist , list (data ))
107+
108+ def test_object_create_container_public (self ):
109+ self .requests_mock .register_uri (
110+ 'PUT' ,
111+ object_fakes .ENDPOINT + '/ernie' ,
112+ headers = {
113+ 'x-trans-id' : '314159' ,
114+ 'x-container-read' : '.r:*,.rlistings'
115+ },
116+ status_code = 200 ,
117+ )
118+
119+ arglist = [
120+ 'ernie' ,
121+ '--public'
122+ ]
123+ verifylist = [
124+ ('containers' , ['ernie' ]),
125+ ('public' , True )
126+ ]
127+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
128+
129+ # In base command class ShowOne in cliff, abstract method take_action()
130+ # returns a two-part tuple with a tuple of column names and a tuple of
131+ # data to be shown.
132+ columns , data = self .cmd .take_action (parsed_args )
133+
134+ self .assertEqual (self .columns , columns )
135+ datalist = [(
136+ object_fakes .ACCOUNT_ID ,
137+ 'ernie' ,
138+ '314159' ,
139+ )]
140+ self .assertEqual (datalist , list (data ))
141+
73142 def test_object_create_container_more (self ):
74143 self .requests_mock .register_uri (
75144 'PUT' ,
@@ -300,6 +369,7 @@ def test_object_show_container(self):
300369 'x-container-write' : 'wsx' ,
301370 'x-container-sync-to' : 'edc' ,
302371 'x-container-sync-key' : 'rfv' ,
372+ 'x-storage-policy' : 'o1--sr-r3'
303373 }
304374 self .requests_mock .register_uri (
305375 'HEAD' ,
@@ -327,6 +397,7 @@ def test_object_show_container(self):
327397 'container' ,
328398 'object_count' ,
329399 'read_acl' ,
400+ 'storage_policy' ,
330401 'sync_key' ,
331402 'sync_to' ,
332403 'write_acl' ,
@@ -338,6 +409,7 @@ def test_object_show_container(self):
338409 'ernie' ,
339410 '42' ,
340411 'qaz' ,
412+ 'o1--sr-r3' ,
341413 'rfv' ,
342414 'edc' ,
343415 'wsx' ,
0 commit comments