def test_from_headers(self):
     mappings = [
         ({'Content-Type': ['text/html; charset=utf-8']}, HtmlResponse),
         ({'Content-Type': ['application/octet-stream'], 'Content-Disposition': ['attachment; filename=data.txt']}, TextResponse),
         ({'Content-Type': ['text/html; charset=utf-8'], 'Content-Encoding': ['gzip']}, Response),
     ]
     for source, cls in mappings:
         source = Headers(source)
         retcls = responsetypes.from_headers(source)
         assert retcls is cls, "%s ==> %s != %s" % (source, retcls, cls)
Exemple #2
0
 def test_from_headers(self):
     mappings = [
         ({'Content-Type': ['text/html; charset=utf-8']}, HtmlResponse),
         ({'Content-Type': ['application/octet-stream'], 'Content-Disposition': ['attachment; filename=data.txt']}, TextResponse),
         ({'Content-Type': ['text/html; charset=utf-8'], 'Content-Encoding': ['gzip']}, Response),
     ]
     for source, cls in mappings:
         source = Headers(source)
         retcls = responsetypes.from_headers(source)
         assert retcls is cls, "%s ==> %s != %s" % (source, retcls, cls)
 def test_from_headers(self):
     mappings = [
         ({"Content-Type": ["text/html; charset=utf-8"]}, HtmlResponse),
         (
             {
                 "Content-Type": ["application/octet-stream"],
                 "Content-Disposition": ["attachment; filename=data.txt"],
             },
             TextResponse,
         ),
         ({"Content-Type": ["text/html; charset=utf-8"], "Content-Encoding": ["gzip"]}, Response),
     ]
     for source, cls in mappings:
         source = Headers(source)
         retcls = responsetypes.from_headers(source)
         assert retcls is cls, "%s ==> %s != %s" % (source, retcls, cls)
Exemple #4
0
 def test_from_headers(self):
     mappings = [
         ({
             "Content-Type": ["text/html; charset=utf-8"]
         }, HtmlResponse),
         (
             {
                 "Content-Type": ["text/html; charset=utf-8"],
                 "Content-Encoding": ["gzip"],
             },
             Response,
         ),
         (
             {
                 "Content-Type": ["application/octet-stream"],
                 "Content-Disposition": ["attachment; filename=data.txt"],
             },
             TextResponse,
         ),
     ]
     for source, cls in mappings:
         source = Headers(source)
         retcls = responsetypes.from_headers(source)
         assert retcls is cls, "%s ==> %s != %s" % (source, retcls, cls)