소스 검색

TESTS: port tests for #590 to docker-compose test

Thomas LEVEIL 8 년 전
부모
커밋
0f1bb344ff
2개의 변경된 파일27개의 추가작업 그리고 0개의 파일을 삭제
  1. 13 0
      test2/test_ssl_nohttps.py
  2. 14 0
      test2/test_ssl_nohttps.yml

+ 13 - 0
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

+ 14 - 0
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