test_acme-http-challenge-location-disabled.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. def test_redirect_acme_challenge_location_disabled(docker_compose, nginxproxy, acme_challenge_path):
  2. r = nginxproxy.get_with_code(
  3. 301,
  4. f"http://web1.nginx-proxy.tld/{acme_challenge_path}",
  5. allow_redirects=False
  6. )
  7. assert r.is_permanent_redirect
  8. def test_redirect_acme_challenge_location_enabled(docker_compose, nginxproxy, acme_challenge_path):
  9. r = nginxproxy.get(
  10. f"http://web2.nginx-proxy.tld/{acme_challenge_path}",
  11. allow_redirects=False
  12. )
  13. assert r.status_code == 200
  14. def test_noredirect_acme_challenge_location_disabled(docker_compose, nginxproxy, acme_challenge_path):
  15. r = nginxproxy.get_with_code(
  16. 404,
  17. f"http://web3.nginx-proxy.tld/{acme_challenge_path}",
  18. allow_redirects=False
  19. )
  20. assert r.status_code == 404
  21. def test_noredirect_acme_challenge_location_enabled(docker_compose, nginxproxy, acme_challenge_path):
  22. r = nginxproxy.get(
  23. f"http://web4.nginx-proxy.tld/{acme_challenge_path}",
  24. allow_redirects=False
  25. )
  26. assert r.status_code == 200
  27. def test_unknown_domain_acme_challenge_location_disabled(docker_compose, nginxproxy, acme_challenge_path):
  28. r = nginxproxy.get_unknown_host(
  29. f"http://web-unknown.nginx-proxy.tld/{acme_challenge_path}",
  30. allow_redirects=False
  31. )
  32. assert r.status_code == 503