mirror of
				https://github.com/thib8956/nginx-proxy
				synced 2025-11-04 02:59:20 +00:00 
			
		
		
		
	Support old and new versions of requests
This commit is contained in:
		@@ -1,6 +1,8 @@
 | 
				
			|||||||
import pytest
 | 
					import pytest
 | 
				
			||||||
 | 
					from backports.ssl_match_hostname import CertificateError
 | 
				
			||||||
from requests.exceptions import SSLError
 | 
					from requests.exceptions import SSLError
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@pytest.mark.parametrize("subdomain,should_redirect_to_https", [
 | 
					@pytest.mark.parametrize("subdomain,should_redirect_to_https", [
 | 
				
			||||||
    (1, True),
 | 
					    (1, True),
 | 
				
			||||||
    (2, True),
 | 
					    (2, True),
 | 
				
			||||||
@@ -22,10 +24,9 @@ def test_https_get_served(docker_compose, nginxproxy, subdomain):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_web3_https_is_500_and_SSL_validation_fails(docker_compose, nginxproxy):
 | 
					def test_web3_https_is_500_and_SSL_validation_fails(docker_compose, nginxproxy):
 | 
				
			||||||
    with pytest.raises(SSLError) as excinfo:
 | 
					    with pytest.raises( (CertificateError, SSLError) ) as excinfo:
 | 
				
			||||||
        nginxproxy.get("https://3.web.nginx-proxy.tld/port")
 | 
					        nginxproxy.get("https://3.web.nginx-proxy.tld/port")
 | 
				
			||||||
    assert """hostname '3.web.nginx-proxy.tld' doesn't match 'nginx-proxy.tld'""" in str(excinfo.value)
 | 
					    assert """hostname '3.web.nginx-proxy.tld' doesn't match 'nginx-proxy.tld'""" in str(excinfo.value)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
    r = nginxproxy.get("https://3.web.nginx-proxy.tld/port", verify=False)
 | 
					    r = nginxproxy.get("https://3.web.nginx-proxy.tld/port", verify=False)
 | 
				
			||||||
    assert r.status_code == 500
 | 
					    assert r.status_code == 500
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user