Commit 96ebdab3 authored by Łukasz Nowak's avatar Łukasz Nowak

rapid-cdn: Clean up response assertions

Changes:

 * clean up tests from simply removing headers before asserting
 * check out unstable headers and correct them
 * improve assertion name
parent 2db639c1
...@@ -985,15 +985,11 @@ class HttpFrontendTestCase(SlapOSInstanceTestCase): ...@@ -985,15 +985,11 @@ class HttpFrontendTestCase(SlapOSInstanceTestCase):
def assertResponseHeaders( def assertResponseHeaders(
self, result, cached=False, via=True, backend_reached=True): self, result, cached=False, via=True, backend_reached=True):
headers = result.headers.copy() headers = result.headers.copy()
self.assertKeyWithPop('Date', headers) self.assertKeyWithPop('Content-Length', headers)
# drop vary-keys
headers.pop('Connection', None)
headers.pop('Content-Length', None)
headers.pop('Keep-Alive', None)
headers.pop('Transfer-Encoding', None)
if backend_reached: if backend_reached:
self.assertEqual('TestBackend', headers.pop('Server', '')) self.assertEqual('TestBackend', headers.pop('Server', ''))
self.assertKeyWithPop('Date', headers)
via_id = '%s-%s' % ( via_id = '%s-%s' % (
self.node_information_dict['node-id'], self.node_information_dict['node-id'],
...@@ -2276,23 +2272,23 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -2276,23 +2272,23 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
self.assertFalse('connection-parameter-hash' in line) self.assertFalse('connection-parameter-hash' in line)
self.assertFalse('timestamp' in line) self.assertFalse('timestamp' in line)
def assertBackendHeaders( def assertRequestHeaders(
self, backend_header_dict, domain=None, source_ip=SOURCE_IP, self, header_dict, domain=None, source_ip=SOURCE_IP,
port=HTTPS_PORT, proto='https', cached=False): port=HTTPS_PORT, proto='https', cached=False):
if domain is not None: if domain is not None:
self.assertEqual( self.assertEqual(
backend_header_dict['host'], header_dict['host'],
'%s:%s' % (domain, port)) '%s:%s' % (domain, port))
self.assertEqual( self.assertEqual(
backend_header_dict['x-forwarded-for'], header_dict['x-forwarded-for'],
source_ip source_ip
) )
self.assertEqual( self.assertEqual(
backend_header_dict['x-forwarded-port'], header_dict['x-forwarded-port'],
port port
) )
self.assertEqual( self.assertEqual(
backend_header_dict['x-forwarded-proto'], header_dict['x-forwarded-proto'],
proto proto
) )
via_id = '%s-%s' % ( via_id = '%s-%s' % (
...@@ -2306,7 +2302,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -2306,7 +2302,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
'http/1.1 rapid-cdn-cache-%(via_id)s' % dict(via_id=via_id), 'http/1.1 rapid-cdn-cache-%(via_id)s' % dict(via_id=via_id),
'HTTP/1.1 rapid-cdn-backend-%(via_id)s' % dict(via_id=via_id) 'HTTP/1.1 rapid-cdn-backend-%(via_id)s' % dict(via_id=via_id)
], ],
backend_header_dict['via'] header_dict['via']
) )
else: else:
self.assertEqual( self.assertEqual(
...@@ -2315,7 +2311,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -2315,7 +2311,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
'HTTP/1.1 rapid-cdn-frontend-%(via_id)s' % dict(via_id=via_id), 'HTTP/1.1 rapid-cdn-frontend-%(via_id)s' % dict(via_id=via_id),
'HTTP/1.1 rapid-cdn-backend-%(via_id)s' % dict(via_id=via_id) 'HTTP/1.1 rapid-cdn-backend-%(via_id)s' % dict(via_id=via_id)
], ],
backend_header_dict['via'] header_dict['via']
) )
def test_url(self): def test_url(self):
...@@ -2352,7 +2348,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -2352,7 +2348,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
self.assertEqual(j['Incoming Headers']['timeout'], '10') self.assertEqual(j['Incoming Headers']['timeout'], '10')
self.assertFalse('Content-Encoding' in headers) self.assertFalse('Content-Encoding' in headers)
self.assertBackendHeaders(j['Incoming Headers'], parameter_dict['domain']) self.assertRequestHeaders(j['Incoming Headers'], parameter_dict['domain'])
self.assertEqual( self.assertEqual(
'secured=value;secure, nonsecured=value', 'secured=value;secure, nonsecured=value',
...@@ -2473,7 +2469,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -2473,7 +2469,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
self.assertEqual(j['Incoming Headers']['timeout'], '10') self.assertEqual(j['Incoming Headers']['timeout'], '10')
self.assertFalse('Content-Encoding' in result.headers) self.assertFalse('Content-Encoding' in result.headers)
self.assertBackendHeaders( self.assertRequestHeaders(
j['Incoming Headers'], parameter_dict['domain']) j['Incoming Headers'], parameter_dict['domain'])
self.assertEqual( self.assertEqual(
...@@ -2548,7 +2544,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -2548,7 +2544,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
self.assertEqual(j['Incoming Headers']['timeout'], '10') self.assertEqual(j['Incoming Headers']['timeout'], '10')
self.assertFalse('Content-Encoding' in result.headers) self.assertFalse('Content-Encoding' in result.headers)
self.assertBackendHeaders(j['Incoming Headers'], parameter_dict['domain']) self.assertRequestHeaders(j['Incoming Headers'], parameter_dict['domain'])
self.assertEqual( self.assertEqual(
'secured=value;secure, nonsecured=value', 'secured=value;secure, nonsecured=value',
...@@ -2746,7 +2742,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -2746,7 +2742,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
self.assertEqual(j['Incoming Headers']['timeout'], '10') self.assertEqual(j['Incoming Headers']['timeout'], '10')
self.assertFalse('Content-Encoding' in result.headers) self.assertFalse('Content-Encoding' in result.headers)
self.assertBackendHeaders(j['Incoming Headers'], parameter_dict['domain']) self.assertRequestHeaders(j['Incoming Headers'], parameter_dict['domain'])
self.assertEqual( self.assertEqual(
'secured=value;secure, nonsecured=value', 'secured=value;secure, nonsecured=value',
...@@ -3054,7 +3050,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -3054,7 +3050,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
j = result.json() j = result.json()
except Exception: except Exception:
raise ValueError('JSON decode problem in:\n%s' % (result.text,)) raise ValueError('JSON decode problem in:\n%s' % (result.text,))
self.assertBackendHeaders(j['Incoming Headers'], parameter_dict['domain']) self.assertRequestHeaders(j['Incoming Headers'], parameter_dict['domain'])
self.assertEqualResultJson( self.assertEqualResultJson(
result, result,
...@@ -3094,7 +3090,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -3094,7 +3090,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
j = result.json() j = result.json()
except Exception: except Exception:
raise ValueError('JSON decode problem in:\n%s' % (result.text,)) raise ValueError('JSON decode problem in:\n%s' % (result.text,))
self.assertBackendHeaders(j['Incoming Headers'], parameter_dict['domain']) self.assertRequestHeaders(j['Incoming Headers'], parameter_dict['domain'])
self.assertEqualResultJson( self.assertEqualResultJson(
result, result,
...@@ -3129,7 +3125,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -3129,7 +3125,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
j = result.json() j = result.json()
except Exception: except Exception:
raise ValueError('JSON decode problem in:\n%s' % (result.text,)) raise ValueError('JSON decode problem in:\n%s' % (result.text,))
self.assertBackendHeaders(j['Incoming Headers'], parameter_dict['domain']) self.assertRequestHeaders(j['Incoming Headers'], parameter_dict['domain'])
self.assertEqualResultJson( self.assertEqualResultJson(
result, result,
...@@ -3172,7 +3168,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -3172,7 +3168,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
j = result.json() j = result.json()
except Exception: except Exception:
raise ValueError('JSON decode problem in:\n%s' % (result.text,)) raise ValueError('JSON decode problem in:\n%s' % (result.text,))
self.assertBackendHeaders(j['Incoming Headers'], parameter_dict['domain']) self.assertRequestHeaders(j['Incoming Headers'], parameter_dict['domain'])
self.assertEqualResultJson( self.assertEqualResultJson(
result, result,
...@@ -3210,7 +3206,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -3210,7 +3206,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
j = result.json() j = result.json()
except Exception: except Exception:
raise ValueError('JSON decode problem in:\n%s' % (result.text,)) raise ValueError('JSON decode problem in:\n%s' % (result.text,))
self.assertBackendHeaders(j['Incoming Headers'], parameter_dict['domain']) self.assertRequestHeaders(j['Incoming Headers'], parameter_dict['domain'])
self.assertEqualResultJson( self.assertEqualResultJson(
result, result,
...@@ -3294,7 +3290,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -3294,7 +3290,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
j = result.json() j = result.json()
except Exception: except Exception:
raise ValueError('JSON decode problem in:\n%s' % (result.text,)) raise ValueError('JSON decode problem in:\n%s' % (result.text,))
self.assertBackendHeaders(j['Incoming Headers'], parameter_dict['domain']) self.assertRequestHeaders(j['Incoming Headers'], parameter_dict['domain'])
self.assertEqual( self.assertEqual(
'Upgrade', 'Upgrade',
j['Incoming Headers']['connection'] j['Incoming Headers']['connection']
...@@ -3324,7 +3320,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -3324,7 +3320,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
j = result.json() j = result.json()
except Exception: except Exception:
raise ValueError('JSON decode problem in:\n%s' % (result.text,)) raise ValueError('JSON decode problem in:\n%s' % (result.text,))
self.assertBackendHeaders(j['Incoming Headers'], parameter_dict['domain']) self.assertRequestHeaders(j['Incoming Headers'], parameter_dict['domain'])
self.assertEqual( self.assertEqual(
'Upgrade', 'Upgrade',
j['Incoming Headers']['connection'] j['Incoming Headers']['connection']
...@@ -3354,7 +3350,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -3354,7 +3350,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
j = result.json() j = result.json()
except Exception: except Exception:
raise ValueError('JSON decode problem in:\n%s' % (result.text,)) raise ValueError('JSON decode problem in:\n%s' % (result.text,))
self.assertBackendHeaders( self.assertRequestHeaders(
j['Incoming Headers'], port='17', proto='irc') j['Incoming Headers'], port='17', proto='irc')
self.assertEqual( self.assertEqual(
'Upgrade', 'Upgrade',
...@@ -3387,7 +3383,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -3387,7 +3383,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
j = result.json() j = result.json()
except Exception: except Exception:
raise ValueError('JSON decode problem in:\n%s' % (result.text,)) raise ValueError('JSON decode problem in:\n%s' % (result.text,))
self.assertBackendHeaders(j['Incoming Headers'], parameter_dict['domain']) self.assertRequestHeaders(j['Incoming Headers'], parameter_dict['domain'])
self.assertFalse('x-real-ip' in j['Incoming Headers']) self.assertFalse('x-real-ip' in j['Incoming Headers'])
result = fakeHTTPSResult( result = fakeHTTPSResult(
...@@ -3405,7 +3401,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -3405,7 +3401,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
j = result.json() j = result.json()
except Exception: except Exception:
raise ValueError('JSON decode problem in:\n%s' % (result.text,)) raise ValueError('JSON decode problem in:\n%s' % (result.text,))
self.assertBackendHeaders(j['Incoming Headers'], parameter_dict['domain']) self.assertRequestHeaders(j['Incoming Headers'], parameter_dict['domain'])
self.assertEqual( self.assertEqual(
'Upgrade', 'Upgrade',
j['Incoming Headers']['connection'] j['Incoming Headers']['connection']
...@@ -3427,7 +3423,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -3427,7 +3423,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
j = result.json() j = result.json()
except Exception: except Exception:
raise ValueError('JSON decode problem in:\n%s' % (result.text,)) raise ValueError('JSON decode problem in:\n%s' % (result.text,))
self.assertBackendHeaders(j['Incoming Headers'], parameter_dict['domain']) self.assertRequestHeaders(j['Incoming Headers'], parameter_dict['domain'])
self.assertEqual( self.assertEqual(
'Upgrade', 'Upgrade',
j['Incoming Headers']['connection'] j['Incoming Headers']['connection']
...@@ -3458,7 +3454,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -3458,7 +3454,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
j = result.json() j = result.json()
except Exception: except Exception:
raise ValueError('JSON decode problem in:\n%s' % (result.text,)) raise ValueError('JSON decode problem in:\n%s' % (result.text,))
self.assertBackendHeaders(j['Incoming Headers'], parameter_dict['domain']) self.assertRequestHeaders(j['Incoming Headers'], parameter_dict['domain'])
self.assertFalse('x-real-ip' in j['Incoming Headers']) self.assertFalse('x-real-ip' in j['Incoming Headers'])
result = fakeHTTPSResult( result = fakeHTTPSResult(
...@@ -3476,7 +3472,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -3476,7 +3472,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
j = result.json() j = result.json()
except Exception: except Exception:
raise ValueError('JSON decode problem in:\n%s' % (result.text,)) raise ValueError('JSON decode problem in:\n%s' % (result.text,))
self.assertBackendHeaders( self.assertRequestHeaders(
j['Incoming Headers'], port='17', proto='irc') j['Incoming Headers'], port='17', proto='irc')
self.assertEqual( self.assertEqual(
'Upgrade', 'Upgrade',
...@@ -3499,7 +3495,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -3499,7 +3495,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
j = result.json() j = result.json()
except Exception: except Exception:
raise ValueError('JSON decode problem in:\n%s' % (result.text,)) raise ValueError('JSON decode problem in:\n%s' % (result.text,))
self.assertBackendHeaders( self.assertRequestHeaders(
j['Incoming Headers'], port='17', proto='irc') j['Incoming Headers'], port='17', proto='irc')
self.assertEqual( self.assertEqual(
'Upgrade', 'Upgrade',
...@@ -3528,7 +3524,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -3528,7 +3524,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
result.headers['Location'] result.headers['Location']
) )
headers = self.assertResponseHeaders( self.assertResponseHeaders(
result, via=False, backend_reached=False) result, via=False, backend_reached=False)
result = fakeHTTPResult( result = fakeHTTPResult(
...@@ -3545,7 +3541,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -3545,7 +3541,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
result.headers['Location'] result.headers['Location']
) )
headers = self.assertResponseHeaders( self.assertResponseHeaders(
result, via=False, backend_reached=False) result, via=False, backend_reached=False)
def test_type_redirect_custom_domain(self): def test_type_redirect_custom_domain(self):
...@@ -3570,10 +3566,9 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -3570,10 +3566,9 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
result.headers['Location'] result.headers['Location']
) )
headers = self.assertResponseHeaders( self.assertResponseHeaders(
result, via=False, backend_reached=False) result, via=False, backend_reached=False)
def test_ssl_proxy_verify_ssl_proxy_ca_crt_unverified(self): def test_ssl_proxy_verify_ssl_proxy_ca_crt_unverified(self):
parameter_dict = self.assertSlaveBase( parameter_dict = self.assertSlaveBase(
'ssl-proxy-verify_ssl_proxy_ca_crt-unverified') 'ssl-proxy-verify_ssl_proxy_ca_crt-unverified')
...@@ -3620,7 +3615,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -3620,7 +3615,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
j = result.json() j = result.json()
except Exception: except Exception:
raise ValueError('JSON decode problem in:\n%s' % (result.text,)) raise ValueError('JSON decode problem in:\n%s' % (result.text,))
self.assertBackendHeaders(j['Incoming Headers'], parameter_dict['domain']) self.assertRequestHeaders(j['Incoming Headers'], parameter_dict['domain'])
self.assertFalse('Content-Encoding' in result.headers) self.assertFalse('Content-Encoding' in result.headers)
...@@ -3859,7 +3854,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -3859,7 +3854,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
) )
backend_headers = result.json()['Incoming Headers'] backend_headers = result.json()['Incoming Headers']
self.assertBackendHeaders( self.assertRequestHeaders(
backend_headers, parameter_dict['domain'], cached=True) backend_headers, parameter_dict['domain'], cached=True)
def test_enable_cache_server_alias(self): def test_enable_cache_server_alias(self):
...@@ -3887,7 +3882,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -3887,7 +3882,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
) )
backend_headers = result.json()['Incoming Headers'] backend_headers = result.json()['Incoming Headers']
self.assertBackendHeaders( self.assertRequestHeaders(
backend_headers, parameter_dict['domain'], cached=True) backend_headers, parameter_dict['domain'], cached=True)
result = fakeHTTPResult( result = fakeHTTPResult(
...@@ -3970,7 +3965,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -3970,7 +3965,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
) )
backend_headers = result.json()['Incoming Headers'] backend_headers = result.json()['Incoming Headers']
self.assertBackendHeaders( self.assertRequestHeaders(
backend_headers, parameter_dict['domain'], cached=True) backend_headers, parameter_dict['domain'], cached=True)
# BEGIN: Check that squid.log is correctly filled in # BEGIN: Check that squid.log is correctly filled in
...@@ -4109,7 +4104,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -4109,7 +4104,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
) )
backend_headers = result.json()['Incoming Headers'] backend_headers = result.json()['Incoming Headers']
self.assertBackendHeaders( self.assertRequestHeaders(
backend_headers, parameter_dict['domain'], cached=True) backend_headers, parameter_dict['domain'], cached=True)
# check stale-if-error support is really respected if not present in the # check stale-if-error support is really respected if not present in the
...@@ -4239,7 +4234,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -4239,7 +4234,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
) )
backend_headers = result.json()['Incoming Headers'] backend_headers = result.json()['Incoming Headers']
self.assertBackendHeaders( self.assertRequestHeaders(
backend_headers, parameter_dict['domain'], cached=True) backend_headers, parameter_dict['domain'], cached=True)
try: try:
...@@ -4273,7 +4268,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -4273,7 +4268,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
) )
backend_headers = result.json()['Incoming Headers'] backend_headers = result.json()['Incoming Headers']
self.assertBackendHeaders( self.assertRequestHeaders(
backend_headers, parameter_dict['domain'], cached=True) backend_headers, parameter_dict['domain'], cached=True)
def test_enable_http2_false(self): def test_enable_http2_false(self):
...@@ -4294,6 +4289,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -4294,6 +4289,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
{ {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'Set-Cookie': 'secured=value;secure, nonsecured=value', 'Set-Cookie': 'secured=value;secure, nonsecured=value',
'Connection': 'keep-alive',
}, },
headers headers
) )
...@@ -4318,6 +4314,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -4318,6 +4314,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
{ {
'Content-type': 'application/json', 'Content-type': 'application/json',
'Set-Cookie': 'secured=value;secure, nonsecured=value', 'Set-Cookie': 'secured=value;secure, nonsecured=value',
'Connection': 'keep-alive',
}, },
headers headers
) )
...@@ -4340,7 +4337,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -4340,7 +4337,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
self.assertEqualResultJson(result, 'Path', '/test-path/deeper') self.assertEqualResultJson(result, 'Path', '/test-path/deeper')
self.assertBackendHeaders( self.assertRequestHeaders(
result.json()['Incoming Headers'], parameter_dict['domain']) result.json()['Incoming Headers'], parameter_dict['domain'])
self.assertEqual( self.assertEqual(
'gzip', result.json()['Incoming Headers']['accept-encoding']) 'gzip', result.json()['Incoming Headers']['accept-encoding'])
...@@ -4352,7 +4349,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -4352,7 +4349,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
self.assertEqualResultJson(result, 'Path', '/test-path/deeper') self.assertEqualResultJson(result, 'Path', '/test-path/deeper')
self.assertBackendHeaders( self.assertRequestHeaders(
result.json()['Incoming Headers'], parameter_dict['domain']) result.json()['Incoming Headers'], parameter_dict['domain'])
self.assertEqual( self.assertEqual(
'deflate', result.json()['Incoming Headers']['accept-encoding']) 'deflate', result.json()['Incoming Headers']['accept-encoding'])
...@@ -4380,7 +4377,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -4380,7 +4377,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
self.assertEqualResultJson(result, 'Path', '/test-path/deeper') self.assertEqualResultJson(result, 'Path', '/test-path/deeper')
self.assertBackendHeaders( self.assertRequestHeaders(
result.json()['Incoming Headers'], parameter_dict['domain'], result.json()['Incoming Headers'], parameter_dict['domain'],
port=HTTP_PORT, proto='http') port=HTTP_PORT, proto='http')
self.assertEqual( self.assertEqual(
...@@ -4393,7 +4390,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -4393,7 +4390,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
self.assertEqualResultJson(result, 'Path', '/test-path/deeper') self.assertEqualResultJson(result, 'Path', '/test-path/deeper')
self.assertBackendHeaders( self.assertRequestHeaders(
result.json()['Incoming Headers'], parameter_dict['domain'], result.json()['Incoming Headers'], parameter_dict['domain'],
port=HTTP_PORT, proto='http') port=HTTP_PORT, proto='http')
self.assertEqual( self.assertEqual(
...@@ -4426,7 +4423,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -4426,7 +4423,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
self.assertEqualResultJson(result, 'Path', '/test-path/deeper') self.assertEqualResultJson(result, 'Path', '/test-path/deeper')
self.assertBackendHeaders( self.assertRequestHeaders(
result.json()['Incoming Headers'], parameter_dict['domain']) result.json()['Incoming Headers'], parameter_dict['domain'])
self.assertEqual( self.assertEqual(
'gzip', result.json()['Incoming Headers']['accept-encoding']) 'gzip', result.json()['Incoming Headers']['accept-encoding'])
...@@ -4438,7 +4435,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -4438,7 +4435,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
self.assertEqualResultJson(result, 'Path', '/test-path/deeper') self.assertEqualResultJson(result, 'Path', '/test-path/deeper')
self.assertBackendHeaders( self.assertRequestHeaders(
result.json()['Incoming Headers'], parameter_dict['domain']) result.json()['Incoming Headers'], parameter_dict['domain'])
self.assertEqual( self.assertEqual(
'deflate', result.json()['Incoming Headers']['accept-encoding']) 'deflate', result.json()['Incoming Headers']['accept-encoding'])
...@@ -4589,7 +4586,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin): ...@@ -4589,7 +4586,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
result.headers['Strict-Transport-Security']) result.headers['Strict-Transport-Security'])
self.assertEqualResultJson(result, 'Path', '/https/test-path/deeper') self.assertEqualResultJson(result, 'Path', '/https/test-path/deeper')
self.assertBackendHeaders( self.assertRequestHeaders(
result.json()['Incoming Headers'], result.json()['Incoming Headers'],
parameter_dict['domain']) parameter_dict['domain'])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment