mirror of
https://github.com/thib8956/nginx-proxy
synced 2025-07-02 06:45:45 +00:00
test: Add test case for default app redirect
Co-authored-by: Jonathan Underwood <junderwood@bitcoinbank.co.jp>
This commit is contained in:
committed by
Nicolas Duchon
parent
e08b3487c9
commit
4099fcd618
18
test/test_virtual-path/test_forwarding.py
Normal file
18
test/test_virtual-path/test_forwarding.py
Normal file
@ -0,0 +1,18 @@
|
||||
import pytest
|
||||
|
||||
def test_root_redirects_to_web1(docker_compose, nginxproxy):
|
||||
r = nginxproxy.get("http://www.nginx-proxy.tld/port", allow_redirects=False)
|
||||
assert r.status_code == 301
|
||||
assert "Location" in r.headers
|
||||
assert "http://www.nginx-proxy.tld/web1/port" == r.headers['Location']
|
||||
|
||||
def test_direct_access(docker_compose, nginxproxy):
|
||||
r = nginxproxy.get("http://www.nginx-proxy.tld/web1/port", allow_redirects=False)
|
||||
assert r.status_code == 200
|
||||
assert "answer from port 81\n" in r.text
|
||||
|
||||
def test_root_is_forwarded(docker_compose, nginxproxy):
|
||||
r = nginxproxy.get("http://www.nginx-proxy.tld/port", allow_redirects=True)
|
||||
assert r.status_code == 200
|
||||
assert "answer from port 81\n" in r.text
|
||||
|
Reference in New Issue
Block a user