mirror of
https://github.com/thib8956/nginx-proxy
synced 2025-07-01 14:25:46 +00:00
tests: cleanup test code
- remove unused imports in test cases - fix code smells and code style in conftest.py
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import json
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
|
@ -1,6 +1,3 @@
|
||||
import pytest
|
||||
|
||||
|
||||
def test_web1_HSTS_default(docker_compose, nginxproxy):
|
||||
r = nginxproxy.get("https://web1.nginx-proxy.tld/port", allow_redirects=False)
|
||||
assert "answer from port 81\n" in r.text
|
||||
|
@ -1,5 +1,6 @@
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.parametrize("subdomain", ["foo", "bar"])
|
||||
def test_web1_http_redirects_to_https(docker_compose, nginxproxy, subdomain):
|
||||
r = nginxproxy.get("http://%s.nginx-proxy.tld:8080/" % subdomain, allow_redirects=False)
|
||||
|
@ -1,7 +1,3 @@
|
||||
import pytest
|
||||
import requests
|
||||
|
||||
|
||||
def test_web2_http_is_connection_refused(docker_compose, nginxproxy):
|
||||
r = nginxproxy.get("http://web2.nginx-proxy.tld/", allow_redirects=False)
|
||||
assert r.status_code == 503
|
||||
|
@ -1,6 +1,7 @@
|
||||
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
|
||||
|
@ -1,6 +1,3 @@
|
||||
import pytest
|
||||
|
||||
|
||||
def test_web3_http_is_forwarded(docker_compose, nginxproxy):
|
||||
r = nginxproxy.get("http://web3.nginx-proxy.tld/port", allow_redirects=False)
|
||||
assert r.status_code == 200
|
||||
|
@ -1,6 +1,7 @@
|
||||
import pytest
|
||||
from requests import ConnectionError
|
||||
|
||||
|
||||
@pytest.mark.parametrize("path", ["web1", "web2"])
|
||||
def test_web1_http_redirects_to_https(docker_compose, nginxproxy, path):
|
||||
r = nginxproxy.get("http://www.nginx-proxy.tld/%s/port" % path, allow_redirects=False)
|
||||
|
Reference in New Issue
Block a user