Commit b9f413ab authored by Łukasz Nowak's avatar Łukasz Nowak Committed by Łukasz Nowak

caddy-frontend: Simplify assertion and use numeric value

parent cd9a6327
...@@ -63,8 +63,6 @@ MONITOR_F1_HTTPD_PORT = '13001' ...@@ -63,8 +63,6 @@ MONITOR_F1_HTTPD_PORT = '13001'
MONITOR_F2_HTTPD_PORT = '13002' MONITOR_F2_HTTPD_PORT = '13002'
no_backend_response_code = 404
caddy_custom_https = '''# caddy_custom_https_filled_in_accepted caddy_custom_https = '''# caddy_custom_https_filled_in_accepted
https://caddycustomhttpsaccepted.example.com:%%(https_port)s { https://caddycustomhttpsaccepted.example.com:%%(https_port)s {
bind %%(local_ipv4)s bind %%(local_ipv4)s
...@@ -812,7 +810,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin): ...@@ -812,7 +810,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
der2pem(result.peercert), der2pem(result.peercert),
open('wildcard.example.com.crt').read()) open('wildcard.example.com.crt').read())
self.assertEqual(result.status_code, no_backend_response_code) self.assertEqual(result.status_code, 404)
# check that log file contains verbose log # check that log file contains verbose log
log_file = glob.glob( log_file = glob.glob(
...@@ -825,7 +823,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin): ...@@ -825,7 +823,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
LOG_REGEXP) LOG_REGEXP)
result_http = self.fakeHTTPResult( result_http = self.fakeHTTPResult(
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path') parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(result_http.status_code, no_backend_response_code) self.assertEqual(result_http.status_code, 404)
# check that 404 is as configured # check that 404 is as configured
result_missing = self.fakeHTTPSResult( result_missing = self.fakeHTTPSResult(
...@@ -1586,11 +1584,11 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin): ...@@ -1586,11 +1584,11 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
der2pem(result.peercert), der2pem(result.peercert),
open('wildcard.example.com.crt').read()) open('wildcard.example.com.crt').read())
self.assertEqual(result.status_code, no_backend_response_code) self.assertEqual(result.status_code, 404)
result_http = self.fakeHTTPResult( result_http = self.fakeHTTPResult(
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path') parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(result_http.status_code, no_backend_response_code) self.assertEqual(result_http.status_code, 404)
# rewrite SR/bin/is-icmp-packet-lost # rewrite SR/bin/is-icmp-packet-lost
open( open(
...@@ -1629,11 +1627,11 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin): ...@@ -1629,11 +1627,11 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
der2pem(result.peercert), der2pem(result.peercert),
open('wildcard.example.com.crt').read()) open('wildcard.example.com.crt').read())
self.assertEqual(result.status_code, no_backend_response_code) self.assertEqual(result.status_code, 404)
result_http = self.fakeHTTPResult( result_http = self.fakeHTTPResult(
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path') parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(result_http.status_code, no_backend_response_code) self.assertEqual(result_http.status_code, 404)
# rewrite SR/bin/is-icmp-packet-lost # rewrite SR/bin/is-icmp-packet-lost
open( open(
...@@ -1672,11 +1670,11 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin): ...@@ -1672,11 +1670,11 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
der2pem(result.peercert), der2pem(result.peercert),
open('wildcard.example.com.crt').read()) open('wildcard.example.com.crt').read())
self.assertEqual(result.status_code, no_backend_response_code) self.assertEqual(result.status_code, 404)
result_http = self.fakeHTTPResult( result_http = self.fakeHTTPResult(
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path') parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(result_http.status_code, no_backend_response_code) self.assertEqual(result_http.status_code, 404)
# rewrite SR/bin/is-icmp-packet-lost # rewrite SR/bin/is-icmp-packet-lost
open( open(
...@@ -2661,7 +2659,7 @@ class TestMalformedBackenUrlSlave(SlaveHttpFrontendTestCase, ...@@ -2661,7 +2659,7 @@ class TestMalformedBackenUrlSlave(SlaveHttpFrontendTestCase,
der2pem(result.peercert), der2pem(result.peercert),
open('wildcard.example.com.crt').read()) open('wildcard.example.com.crt').read())
self.assertEqual(result.status_code, no_backend_response_code) self.assertEqual(result.status_code, 404)
def test_url(self): def test_url(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.slave_connection_parameter_dict_dict[
...@@ -2967,7 +2965,7 @@ https://www.google.com {}""", ...@@ -2967,7 +2965,7 @@ https://www.google.com {}""",
der2pem(result.peercert), der2pem(result.peercert),
open('wildcard.example.com.crt').read()) open('wildcard.example.com.crt').read())
self.assertEqual(result.status_code, no_backend_response_code) self.assertEqual(result.status_code, 404)
# rewrite SR/bin/is-icmp-packet-lost # rewrite SR/bin/is-icmp-packet-lost
open( open(
...@@ -3012,7 +3010,7 @@ https://www.google.com {}""", ...@@ -3012,7 +3010,7 @@ https://www.google.com {}""",
der2pem(result.peercert), der2pem(result.peercert),
open('wildcard.example.com.crt').read()) open('wildcard.example.com.crt').read())
self.assertEqual(result.status_code, no_backend_response_code) self.assertEqual(result.status_code, 404)
# assert that there is no nocomma file # assert that there is no nocomma file
monitor_file_list = glob.glob( monitor_file_list = glob.glob(
...@@ -3152,11 +3150,11 @@ https://www.google.com {}""", ...@@ -3152,11 +3150,11 @@ https://www.google.com {}""",
der2pem(result.peercert), der2pem(result.peercert),
open('wildcard.example.com.crt').read()) open('wildcard.example.com.crt').read())
self.assertEqual(result.status_code, no_backend_response_code) self.assertEqual(result.status_code, 404)
result_http = self.fakeHTTPResult( result_http = self.fakeHTTPResult(
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path') parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(result_http.status_code, no_backend_response_code) self.assertEqual(result_http.status_code, 404)
# rewrite SR/bin/is-icmp-packet-lost # rewrite SR/bin/is-icmp-packet-lost
open( open(
...@@ -3195,11 +3193,11 @@ https://www.google.com {}""", ...@@ -3195,11 +3193,11 @@ https://www.google.com {}""",
der2pem(result.peercert), der2pem(result.peercert),
open('wildcard.example.com.crt').read()) open('wildcard.example.com.crt').read())
self.assertEqual(result.status_code, no_backend_response_code) self.assertEqual(result.status_code, 404)
result_http = self.fakeHTTPResult( result_http = self.fakeHTTPResult(
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path') parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(result_http.status_code, no_backend_response_code) self.assertEqual(result_http.status_code, 404)
# rewrite SR/bin/is-icmp-packet-lost # rewrite SR/bin/is-icmp-packet-lost
open( open(
......
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