#NEWLINE# def test_determine_format( self ) : #NEWLINE# #INDENT# serializer = Serializer ( ) #NEWLINE# request = HttpRequest ( ) #NEWLINE# self . assertEqual ( determine_format ( request , serializer ) , 'application/json' ) #NEWLINE# request . GET = { #NEWLINE# #INDENT# 'format' : 'json' , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertEqual ( determine_format ( request , serializer ) , 'application/json' ) #NEWLINE# request . GET = { #NEWLINE# #INDENT# 'format' : 'jsonp' , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertEqual ( determine_format ( request , serializer ) , 'text/javascript' ) #NEWLINE# request . GET = { #NEWLINE# #INDENT# 'format' : 'xml' , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertEqual ( determine_format ( request , serializer ) , 'application/xml' ) #NEWLINE# request . GET = { #NEWLINE# #INDENT# 'format' : 'yaml' , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertEqual ( determine_format ( request , serializer ) , 'text/yaml' ) #NEWLINE# request . GET = { #NEWLINE# #INDENT# 'format' : 'plist' , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertEqual ( determine_format ( request , serializer ) , 'application/x-plist' ) #NEWLINE# request . GET = { #NEWLINE# #INDENT# 'format' : 'foo' , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertEqual ( determine_format ( request , serializer ) , 'application/json' ) #NEWLINE# request . META = { #NEWLINE# #INDENT# 'HTTP_ACCEPT' : 'application/json' , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertEqual ( determine_format ( request , serializer ) , 'application/json' ) #NEWLINE# request . META = { #NEWLINE# #INDENT# 'HTTP_ACCEPT' : 'text/javascript' , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertEqual ( determine_format ( request , serializer ) , 'text/javascript' ) #NEWLINE# request . META = { #NEWLINE# #INDENT# 'HTTP_ACCEPT' : 'application/xml' , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertEqual ( determine_format ( request , serializer ) , 'application/xml' ) #NEWLINE# request . META = { #NEWLINE# #INDENT# 'HTTP_ACCEPT' : 'text/yaml' , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertEqual ( determine_format ( request , serializer ) , 'text/yaml' ) #NEWLINE# request . META = { #NEWLINE# #INDENT# 'HTTP_ACCEPT' : 'application/x-plist' , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertEqual ( determine_format ( request , serializer ) , 'application/x-plist' ) #NEWLINE# request . META = { #NEWLINE# #INDENT# 'HTTP_ACCEPT' : 'text/html' , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertEqual ( determine_format ( request , serializer ) , 'text/html' ) #NEWLINE# request . META = { #NEWLINE# #INDENT# 'HTTP_ACCEPT' : '*/*' , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertEqual ( determine_format ( request , serializer ) , 'application/json' ) #NEWLINE# request . META = { #NEWLINE# #INDENT# 'HTTP_ACCEPT' : 'application/json,application/xml;q=0.9,*/*;q=0.8' , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertEqual ( determine_format ( request , serializer ) , 'application/json' ) #NEWLINE# request . META = { #NEWLINE# #INDENT# 'HTTP_ACCEPT' : 'text/plain,application/xml,application/json;q=0.9,*/*;q=0.8' , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertEqual ( determine_format ( request , serializer ) , 'application/xml' ) #NEWLINE# request . META = { #NEWLINE# #INDENT# 'HTTP_ACCEPT' : 'application/json; charset=UTF-8' , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertEqual ( determine_format ( request , serializer ) , 'application/json' ) #NEWLINE# request . META = { #NEWLINE# #INDENT# 'HTTP_ACCEPT' : 'text/javascript,application/json' , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertEqual ( determine_format ( request , serializer ) , 'application/json' )