Mercurial > p > roundup > code
view test/test_misc.py @ 6548:de5f5f9c02f2
Fix spurious content-ty on 304; xfail css Cache-Control
Using wsgiref.validate.validator to verify http/wsgi responses.
It discovered that a 304 was returning a content-type header but
shouldn't. Fixed that.
For some unknown reason I can't reproduce on my devel
platform, travis-ci is throwing:
> self.assertEqual(f.headers['Cache-Control'], 'public, max-age=4838400')
E AssertionError: 'public, max-age=3600' != 'public, max-age=4838400'
E - public, max-age=3600
E ? ^
E + public, max-age=4838400
E ? ++ ^^
in test_liveserver test_cache_control_css. I have no idea why this is
happening. The 3600 value isn't in the code base or tracker template
that I see. While I was trying to figure out if the wsgi server later
was an issue, I came across the validator. Maybe it will throw some
light on this error?
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Thu, 09 Dec 2021 20:11:58 -0500 |
| parents | 3b945aee0919 |
| children | 5986ddd0d2e7 |
line wrap: on
line source
# misc tests import unittest import roundup.anypy.cmp_ from roundup.cgi.accept_language import parse class AcceptLanguageTest(unittest.TestCase): def testParse(self): self.assertEqual(parse("da, en-gb;q=0.8, en;q=0.7"), ['da', 'en_gb', 'en']) self.assertEqual(parse("da, en-gb;q=0.7, en;q=0.8"), ['da', 'en', 'en_gb']) self.assertEqual(parse("en;q=0.2, fr;q=1"), ['fr', 'en']) self.assertEqual(parse("zn; q = 0.2 ,pt-br;q =1"), ['pt_br', 'zn']) self.assertEqual(parse("pt-br;q =1, zn; q = 0.2"), ['pt_br', 'zn']) self.assertEqual(parse("pt-br,zn;q= 0.1, en-US;q=0.5"), ['pt_br', 'en_US', 'zn']) # verify that items with q=1.0 are in same output order as input self.assertEqual(parse("pt-br,en-US; q=0.5, zn;q= 1.0" ), ['pt_br', 'zn', 'en_US']) self.assertEqual(parse("zn;q=1.0;q= 1.0,pt-br,en-US; q=0.5" ), ['zn', 'pt_br', 'en_US']) self.assertEqual(parse("es-AR"), ['es_AR']) self.assertEqual(parse("es-es-cat"), ['es_es_cat']) self.assertEqual(parse(""), []) self.assertEqual(parse(None),[]) self.assertEqual(parse(" "), []) self.assertEqual(parse("en,"), ['en']) class CmpTest(unittest.TestCase): def testCmp(self): roundup.anypy.cmp_._test()
