示例#1
0
 def test_parse_accept_header_browser(self):
     accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8,application/json"
     should = [('text', 'html', {}, 1.0),
               ('application', 'xhtml+xml', {}, 1.0),
               ('application', 'json', {}, 1.0),
               ('application', 'xml', {}, 0.9), ('*', '*', {}, 0.8)]
     self.assertEquals(parse_accept_header(accept), should)
示例#2
0
 def test_parse_accept_header_smart_client(self):
     accept = "application/vnd.ficture.lightt-v1.1+json"
     should = [('application', 'json', {
         'version': 1.1,
         'vendor': 'vnd.ficture.lightt'
     }, 1.0)]
     self.assertEquals(parse_accept_header(accept), should)
示例#3
0
 def test_parse_accept_header_really_dumb_client(self):
     accept = ""
     should = [('', '', {}, 1.0)]
     self.assertEquals(parse_accept_header(accept), should)
示例#4
0
 def test_parse_accept_header_dumb_client(self):
     accept = "application/json"
     should = [('application', 'json', {}, 1.0)]
     self.assertEquals(parse_accept_header(accept), should)
示例#5
0
 def test_parse_accept_header_also_dumb_client(self):
     accept = "application/vnd.ficture.lightt"
     should = [('application', 'vnd.ficture.lightt', {}, 1.0)]
     self.assertEquals(parse_accept_header(accept), should)