@@ -228,8 +228,8 @@ def getheader(self, name, default=None):
228
228
229
229
def connect (* args , ** ckwargs ):
230
230
if 'give_content_type' in kwargs :
231
- if len (args ) >= 7 and 'content_type ' in args [6 ]:
232
- kwargs ['give_content_type' ](args [6 ]['content-type ' ])
231
+ if len (args ) >= 7 and 'Content-Type ' in args [6 ]:
232
+ kwargs ['give_content_type' ](args [6 ]['Content-Type ' ])
233
233
else :
234
234
kwargs ['give_content_type' ]('' )
235
235
if 'give_connect' in kwargs :
@@ -795,17 +795,26 @@ def test_PUT_auto_content_type(self):
795
795
'container' , 'object' )
796
796
797
797
def test_content_type (filename , expected ):
798
- proxy_server .http_connect = fake_http_connect (201 , 201 , 201 ,
798
+ # The three responses here are for account_info() (HEAD to account server),
799
+ # container_info() (HEAD to container server) and three calls to
800
+ # _connect_put_node() (PUT to three object servers)
801
+ proxy_server .http_connect = fake_http_connect (201 , 201 , 201 , 201 , 201 ,
799
802
give_content_type = lambda content_type :
800
803
self .assertEquals (content_type , expected .next ()))
801
- req = Request .blank ('/a/c/%s' % filename , {})
804
+ # We need into include a transfer-encoding to get past
805
+ # constraints.check_object_creation()
806
+ req = Request .blank ('/a/c/%s' % filename , {}, headers = {'transfer-encoding' : 'chunked' })
802
807
self .app .update_request (req )
808
+ self .app .memcache .store = {}
803
809
res = controller .PUT (req )
804
- test_content_type ('test.jpg' , iter (['' , '' , '' , 'image/jpeg' ,
810
+ # If we don't check the response here we could miss problems in PUT()
811
+ self .assertEquals (res .status_int , 201 )
812
+
813
+ test_content_type ('test.jpg' , iter (['' , '' , 'image/jpeg' ,
805
814
'image/jpeg' , 'image/jpeg' ]))
806
- test_content_type ('test.html' , iter (['' , '' , '' , ' text/html' ,
815
+ test_content_type ('test.html' , iter (['' , '' , 'text/html' ,
807
816
'text/html' , 'text/html' ]))
808
- test_content_type ('test.css' , iter (['' , '' , '' , ' text/css' ,
817
+ test_content_type ('test.css' , iter (['' , '' , 'text/css' ,
809
818
'text/css' , 'text/css' ]))
810
819
811
820
def test_custom_mime_types_files (self ):
0 commit comments