Commit 6ee17e27 authored by Łukasz Nowak's avatar Łukasz Nowak Committed by Łukasz Nowak

caddy-frontend: Use httplib constants

parent 5c6998e4
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
import glob import glob
import os import os
import requests import requests
import httplib
from requests_toolbelt.adapters import source from requests_toolbelt.adapters import source
import json import json
import multiprocessing import multiprocessing
...@@ -813,7 +814,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -813,7 +814,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
der2pem(result.peercert), der2pem(result.peercert),
open('wildcard.example.com.crt').read()) open('wildcard.example.com.crt').read())
self.assertEqual(result.status_code, 404) self.assertEqual(result.status_code, httplib.NOT_FOUND)
# check that log file contains verbose log # check that log file contains verbose log
log_file = glob.glob( log_file = glob.glob(
...@@ -831,12 +832,12 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -831,12 +832,12 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
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, 404) self.assertEqual(result_http.status_code, httplib.NOT_FOUND)
# check that 404 is as configured # check that 404 is as configured
result_missing = self.fakeHTTPSResult( result_missing = self.fakeHTTPSResult(
'forsuredoesnotexists.example.com', parameter_dict['public-ipv4'], '') 'forsuredoesnotexists.example.com', parameter_dict['public-ipv4'], '')
self.assertEqual(404, result_missing.status_code) self.assertEqual(httplib.NOT_FOUND, result_missing.status_code)
self.assertEqual( self.assertEqual(
"""<html> """<html>
<head> <head>
...@@ -1387,7 +1388,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1387,7 +1388,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
self.assertEqual( self.assertEqual(
result.status_code, result.status_code,
501 httplib.NOT_IMPLEMENTED
) )
result_http = self.fakeHTTPResult( result_http = self.fakeHTTPResult(
...@@ -1395,7 +1396,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1395,7 +1396,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
self.assertEqual( self.assertEqual(
result_http.status_code, result_http.status_code,
501 httplib.NOT_IMPLEMENTED
) )
def test_ssl_proxy_verify_unverified(self): def test_ssl_proxy_verify_unverified(self):
...@@ -1457,7 +1458,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1457,7 +1458,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
self.assertEqual( self.assertEqual(
result.status_code, result.status_code,
501 httplib.NOT_IMPLEMENTED
) )
result_http = self.fakeHTTPResult( result_http = self.fakeHTTPResult(
...@@ -1465,7 +1466,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1465,7 +1466,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
self.assertEqual( self.assertEqual(
result_http.status_code, result_http.status_code,
501 httplib.NOT_IMPLEMENTED
) )
def test_enable_cache_ssl_proxy_verify_unverified(self): def test_enable_cache_ssl_proxy_verify_unverified(self):
...@@ -1527,7 +1528,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1527,7 +1528,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
self.assertEqual( self.assertEqual(
result.status_code, result.status_code,
501 httplib.NOT_IMPLEMENTED
) )
result_http = self.fakeHTTPResult( result_http = self.fakeHTTPResult(
...@@ -1535,7 +1536,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1535,7 +1536,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
self.assertEqual( self.assertEqual(
result_http.status_code, result_http.status_code,
501 httplib.NOT_IMPLEMENTED
) )
def test_type_zope_ssl_proxy_verify_unverified(self): def test_type_zope_ssl_proxy_verify_unverified(self):
...@@ -1592,11 +1593,11 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1592,11 +1593,11 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
der2pem(result.peercert), der2pem(result.peercert),
open('wildcard.example.com.crt').read()) open('wildcard.example.com.crt').read())
self.assertEqual(result.status_code, 404) self.assertEqual(result.status_code, httplib.NOT_FOUND)
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, 404) self.assertEqual(result_http.status_code, httplib.NOT_FOUND)
# rewrite SR/bin/is-icmp-packet-lost # rewrite SR/bin/is-icmp-packet-lost
open( open(
...@@ -1635,11 +1636,11 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1635,11 +1636,11 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
der2pem(result.peercert), der2pem(result.peercert),
open('wildcard.example.com.crt').read()) open('wildcard.example.com.crt').read())
self.assertEqual(result.status_code, 404) self.assertEqual(result.status_code, httplib.NOT_FOUND)
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, 404) self.assertEqual(result_http.status_code, httplib.NOT_FOUND)
# rewrite SR/bin/is-icmp-packet-lost # rewrite SR/bin/is-icmp-packet-lost
open( open(
...@@ -1678,11 +1679,11 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -1678,11 +1679,11 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
der2pem(result.peercert), der2pem(result.peercert),
open('wildcard.example.com.crt').read()) open('wildcard.example.com.crt').read())
self.assertEqual(result.status_code, 404) self.assertEqual(result.status_code, httplib.NOT_FOUND)
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, 404) self.assertEqual(result_http.status_code, httplib.NOT_FOUND)
# rewrite SR/bin/is-icmp-packet-lost # rewrite SR/bin/is-icmp-packet-lost
open( open(
...@@ -2667,7 +2668,7 @@ class TestMalformedBackenUrlSlave(SlaveHttpFrontendTestCase, ...@@ -2667,7 +2668,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, 404) self.assertEqual(result.status_code, httplib.NOT_FOUND)
def test_url(self): def test_url(self):
parameter_dict = self.slave_connection_parameter_dict_dict[ parameter_dict = self.slave_connection_parameter_dict_dict[
...@@ -2973,7 +2974,7 @@ https://www.google.com {}""", ...@@ -2973,7 +2974,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, 404) self.assertEqual(result.status_code, httplib.NOT_FOUND)
# rewrite SR/bin/is-icmp-packet-lost # rewrite SR/bin/is-icmp-packet-lost
open( open(
...@@ -3018,7 +3019,7 @@ https://www.google.com {}""", ...@@ -3018,7 +3019,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, 404) self.assertEqual(result.status_code, httplib.NOT_FOUND)
# assert that there is no nocomma file # assert that there is no nocomma file
monitor_file_list = glob.glob( monitor_file_list = glob.glob(
...@@ -3158,11 +3159,11 @@ https://www.google.com {}""", ...@@ -3158,11 +3159,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, 404) self.assertEqual(result.status_code, httplib.NOT_FOUND)
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, 404) self.assertEqual(result_http.status_code, httplib.NOT_FOUND)
# rewrite SR/bin/is-icmp-packet-lost # rewrite SR/bin/is-icmp-packet-lost
open( open(
...@@ -3201,11 +3202,11 @@ https://www.google.com {}""", ...@@ -3201,11 +3202,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, 404) self.assertEqual(result.status_code, httplib.NOT_FOUND)
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, 404) self.assertEqual(result_http.status_code, httplib.NOT_FOUND)
# 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