예제 #1
0
 def testCaseInsensitive(self):
   self.assertEquals('application/X-Google-protobuf',
                     util.choose_content_type(
                       'application/x-google-protobuf',
                       ['application/X-Google-protobuf',
                        'application/json'
                       ]))
예제 #2
0
 def testUseCorrectPreferenceIndex(self):
   self.assertEquals('application/json',
                     util.choose_content_type(
                       '*/*, text/plain, application/json',
                       ['application/X-Google-protobuf',
                        'application/json'
                       ]))
예제 #3
0
 def testPreferFirstInList(self):
   self.assertEquals('application/X-Google-protobuf',
                     util.choose_content_type(
                       '*/*',
                       ['application/X-Google-protobuf',
                        'application/json'
                       ]))
예제 #4
0
 def testIgnoreUnrequested(self):
   self.assertEquals('application/json',
                     util.choose_content_type(
                       'text/plain, application/json, */*',
                       ['application/X-Google-protobuf',
                        'application/json'
                       ]))
예제 #5
0
 def testCaseInsensitive(self):
   self.assertEquals('application/X-Google-protobuf',
                     util.choose_content_type(
                       'application/x-google-protobuf',
                       ['application/X-Google-protobuf',
                        'application/json'
                       ]))
예제 #6
0
 def testPreferFirstInList(self):
   self.assertEquals('application/X-Google-protobuf',
                     util.choose_content_type(
                       '*/*',
                       ['application/X-Google-protobuf',
                        'application/json'
                       ]))
예제 #7
0
 def testUseCorrectPreferenceIndex(self):
   self.assertEquals('application/json',
                     util.choose_content_type(
                       '*/*, text/plain, application/json',
                       ['application/X-Google-protobuf',
                        'application/json'
                       ]))
예제 #8
0
 def testIgnoreUnrequested(self):
   self.assertEquals('application/json',
                     util.choose_content_type(
                       'text/plain, application/json, */*',
                       ['application/X-Google-protobuf',
                        'application/json'
                       ]))