Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Leymonerie
slapos
Commits
6ee17e27
Commit
6ee17e27
authored
Sep 13, 2018
by
Łukasz Nowak
Committed by
Łukasz Nowak
Sep 14, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
caddy-frontend: Use httplib constants
parent
5c6998e4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
22 deletions
+23
-22
software/caddy-frontend/test/test.py
software/caddy-frontend/test/test.py
+23
-22
No files found.
software/caddy-frontend/test/test.py
View file @
6ee17e27
...
@@ -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(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment