'æµè¯äœ¿çšCDNçåŸç https://httpbin.org/image/jpeg'

def test_img_cdn(self):

    self.rv = self.client.get(self.url('/image/jpeg'), environ_base=env(), headers=headers())
    self.assertEqual('image/jpeg', self.rv.content_type, msg=self.dump())
    self.assertEqual(200, self.rv.status_code, msg=self.dump())
    self.assertEqual(2546631231, crc32(self.rv.data), msg=self.dump())
    with self.app.test_client() as c:
        self.rv2 = c.get(self.url('/image/jpeg'), environ_base=env(), headers=headers())
        self.assertEqual(self.zmirror.cdn_redirect_code_if_cannot_hard_rewrite, self.rv2.status_code, msg=self.dump())
        self.assertEqual('https://cdn2.zmirror-unittest.com/image/jpeg', self.rv2.location, msg=self.dump())
    with self.app.test_client() as c:
        self.rv2 = c.get(self.url('/image/jpeg?q=2'), environ_base=env(), headers=headers())
        self.assertEqual('image/jpeg', self.rv2.content_type, msg=self.dump())
        self.assertEqual(200, self.rv2.status_code, msg=self.dump())
        self.assertEqual(2546631231, crc32(self.rv2.data), msg=self.dump())
    with self.app.test_client() as c:
        self.rv2 = c.get(self.url('/image/jpeg?q=2'), environ_base=env(), headers=headers())
        self.assertEqual(self.zmirror.cdn_redirect_code_if_cannot_hard_rewrite, self.rv2.status_code, msg=self.dump())
        self.assertEqual('https://cdn3.zmirror-unittest.com/image/jpeg_{salt}_.cT0y._{salt}_.jpg'.format(salt=self.zmirror.cdn_url_query_encode_salt), self.rv2.location, msg=self.dump())
