'Test parsing of Accept-Encoding'

def test_accept_encoding(self):

    from calibre.srv.http_response import acceptable_encoding
    def test(name, val, ans, allowed={u'gzip'}):
        self.ae(acceptable_encoding(val, allowed), ans, (name + u'    failed'))
    test(u'Empty    field', u'', None)
    test(u'Simple', u'gzip', u'gzip')
    test(u'Case    insensitive', u'GZIp', u'gzip')
    test(u'Multiple', u'gzip,    identity', u'gzip')
    test(u'Priority', u'1;q=0.5,    2;q=0.75,    3;q=1.0', u'3', {u'1', u'2', u'3'})
