1
0
mirror of https://github.com/pi-hole/docker-pi-hole.git synced 2024-06-20 06:26:38 +02:00

Added more http endpoint tests

Forgot to uncomment these, revealed a flaw in the nginx config
nginx now has parity with lighttpd for pages it returns and return codes
This commit is contained in:
diginc 2016-08-28 01:11:55 -05:00
parent 49bae4f0cd
commit 30fe0a3353
3 changed files with 10 additions and 11 deletions

View File

@ -14,13 +14,17 @@ http {
server {
listen 80;
listen [::]:80;
root /var/www/html/pihole;
index index.php index.html index.nginx-debian.html;
root /var/www/html;
index /pihole/index.html;
error_page 404 =200 /pihole/index.html;
error_page 404 /pihole/index.html;
location / {
add_header X-Pi-hole "A black hole for Internet advertisements." always;
}
location ~ ^/admin/ {
add_header X-Pi-hole "The Pi-hole Web interface is working!";
add_header X-Frame-Options "DENY" always;
location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
@ -30,9 +34,6 @@ http {
}
}
location / {
add_header X-Pi-hole "A black hole for Internet advertisements." always;
}
}
}

View File

@ -77,7 +77,7 @@ def Slow():
Run a slow check, check if the state is correct for `timeout` seconds.
"""
import time
def slow(check, timeout=15):
def slow(check, timeout=5):
timeout_at = time.time() + timeout
while True:
try:

View File

@ -33,8 +33,7 @@ def test_indecies_are_present(RunningPiHole):
File('/var/www/html/pihole/index.html').exists
File('/var/www/html/pihole/index.js').exists
@pytest.mark.parametrize('url', [ '/' ] )
#@pytest.mark.parametrize('url', [ '/', '/index.html', 'any.html' ] )
@pytest.mark.parametrize('url', [ '/', '/index.html', '/any.html' ] )
def test_html_index_requests_load_as_expected(RunningPiHole, url):
command = 'curl -s -o /tmp/curled_file -w "%{{http_code}}" http://127.0.0.1{}'.format(url)
print command
@ -44,8 +43,7 @@ def test_html_index_requests_load_as_expected(RunningPiHole, url):
assert RunningPiHole.run('md5sum /tmp/curled_file /var/www/html/pihole/index.html').rc == 0
assert int(http_rc.stdout) == 200
@pytest.mark.parametrize('url', [ '/index.js' ] )
#@pytest.mark.parametrize('url', [ '/index.js', '/any.js'] )
@pytest.mark.parametrize('url', [ '/index.js', '/any.js'] )
def test_javascript_requests_load_as_expected(RunningPiHole, url):
command = 'curl -s -o /tmp/curled_file -w "%{{http_code}}" http://127.0.0.1{}'.format(url)
print command