'Test that the given url can be requested, returns a 200, and returns
a valid gzipped response when requested with Accept-Encoding over ssl.
Return the result of a regular (non-gzipped) request.'

@mock.patch('mkt.commonplace.views.fxa_auth_info')
def _test_url(self, url, fxa_mock, url_kwargs=None):

    fxa_mock.return_value = ('fakestate', 'http://example.com/fakeauthurl')
    if (not url_kwargs):
        url_kwargs = {}
    res = self.client.get(url, url_kwargs, HTTP_ACCEPT_ENCODING='gzip', **{'wsgi.url_scheme': 'https'})
    eq_(res.status_code, 200)
    eq_(res['Content-Encoding'], 'gzip')
    eq_(sorted(res['Vary'].split(',    ')), ['Accept-Encoding', 'Accept-Language', 'Cookie'])
    ungzipped_content = GzipFile('', 'r', 0, StringIO(res.content)).read()
    res = self.client.get(url, url_kwargs, **{'wsgi.url_scheme': 'https'})
    eq_(res.status_code, 200)
    eq_(sorted(res['Vary'].split(',    ')), ['Accept-Encoding', 'Accept-Language', 'Cookie'])
    eq_(ungzipped_content, res.content)
    return res
