1
0
mirror of https://github.com/nginx-proxy/nginx-proxy synced 2025-02-05 05:41:39 +01:00
nginx-proxy/test/test_ssl/test_nohttps.py
Nicolas Duchon b5dea1cf50 tests: cleanup test code
- remove unused imports in test cases
- fix code smells and code style in conftest.py
2024-12-24 13:53:09 +01:00

22 lines
692 B
Python

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):
nginxproxy.get("https://web.nginx-proxy.tld/", allow_redirects=False)
def test_http_acme_challenge_does_not_work(docker_compose, nginxproxy, acme_challenge_path):
r = nginxproxy.get(
f"http://web.nginx-proxy.tld/{acme_challenge_path}",
allow_redirects=False
)
assert r.status_code == 404