From 0f1bb344ff3ed7beec75db8e15bd9d4a50c2598a Mon Sep 17 00:00:00 2001 From: Thomas LEVEIL Date: Sat, 14 Jan 2017 12:30:48 +0100 Subject: [PATCH] TESTS: port tests for #590 to docker-compose test --- test2/test_ssl_nohttps.py | 13 +++++++++++++ test2/test_ssl_nohttps.yml | 14 ++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 test2/test_ssl_nohttps.py create mode 100644 test2/test_ssl_nohttps.yml diff --git a/test2/test_ssl_nohttps.py b/test2/test_ssl_nohttps.py new file mode 100644 index 0000000..025ac28 --- /dev/null +++ b/test2/test_ssl_nohttps.py @@ -0,0 +1,13 @@ +import pytest +from requests import ConnectionError + +def test_http_is_forwarded(docker_compose, nginxproxy): + r = nginxproxy.get("http://web.nginx-proxy.tld/port", allow_redirects=False) + assert r.status_code == 200 + assert "answer from port 83\n" in r.text + + +def test_https_is_disabled(docker_compose, nginxproxy): + with pytest.raises(ConnectionError) as excinfo: + r = nginxproxy.get("https://web.nginx-proxy.tld/", allow_redirects=False) + assert "[Errno 93] Protocol not supportedd" in excinfo.value diff --git a/test2/test_ssl_nohttps.yml b/test2/test_ssl_nohttps.yml new file mode 100644 index 0000000..2e7623a --- /dev/null +++ b/test2/test_ssl_nohttps.yml @@ -0,0 +1,14 @@ +web: + image: web + expose: + - "83" + environment: + WEB_PORTS: "83" + VIRTUAL_HOST: "web.nginx-proxy.tld" + HTTPS_METHOD: nohttps + + +sut: + image: jwilder/nginx-proxy:test + volumes: + - /var/run/docker.sock:/tmp/docker.sock:ro \ No newline at end of file