2
0

test_location-per-vhost.py 929 B

12345678910111213141516171819202122
  1. import pytest
  2. def test_custom_conf_does_not_apply_to_unknown_vhost(docker_compose, nginxproxy):
  3. r = nginxproxy.get("http://nginx-proxy/")
  4. assert r.status_code == 503
  5. assert "X-test" not in r.headers
  6. def test_custom_conf_applies_to_web1(docker_compose, nginxproxy):
  7. r = nginxproxy.get("http://web1.nginx-proxy.local/port")
  8. assert r.status_code == 200
  9. assert r.text == "answer from port 81\n"
  10. assert "X-test" in r.headers
  11. assert "f00" == r.headers["X-test"]
  12. def test_custom_conf_does_not_apply_to_web2(docker_compose, nginxproxy):
  13. r = nginxproxy.get("http://web2.nginx-proxy.local/port")
  14. assert r.status_code == 200
  15. assert r.text == "answer from port 82\n"
  16. assert "X-test" not in r.headers
  17. def test_custom_block_is_present_in_nginx_generated_conf(docker_compose, nginxproxy):
  18. assert "include /etc/nginx/vhost.d/web1.nginx-proxy.local_location;" in nginxproxy.get_conf()