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

fixed problem with nginx admin, added test!

This commit is contained in:
diginc 2016-08-28 02:01:48 -05:00
parent c3de49f154
commit da44042bd4
2 changed files with 13 additions and 9 deletions

View File

@ -15,16 +15,11 @@ http {
listen 80;
listen [::]:80;
root /var/www/html;
index /pihole/index.html;
index index.php pihole/index.html;
error_page 404 =200 /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;
@ -34,6 +29,9 @@ http {
}
}
location / {
add_header X-Pi-hole "A black hole for Internet advertisements." always;
}
}
}

View File

@ -36,10 +36,7 @@ def test_indecies_are_present(RunningPiHole):
@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
http_rc = RunningPiHole.run(command)
print RunningPiHole.run('ls -lat /tmp/curled_file').stdout
print RunningPiHole.run('cat /tmp/curled_file').stdout
assert RunningPiHole.run('md5sum /tmp/curled_file /var/www/html/pihole/index.html').rc == 0
assert int(http_rc.stdout) == 200
@ -50,3 +47,12 @@ def test_javascript_requests_load_as_expected(RunningPiHole, url):
http_rc = RunningPiHole.run(command)
assert RunningPiHole.run('md5sum /tmp/curled_file /var/www/html/pihole/index.js').rc == 0
assert int(http_rc.stdout) == 200
@pytest.mark.parametrize('url', [ '/admin/', '/admin/index.php' ] )
def test_admin_requests_load_as_expected(RunningPiHole, url):
command = 'curl -s -o /tmp/curled_file -w "%{{http_code}}" http://127.0.0.1{}'.format(url)
http_rc = RunningPiHole.run(command)
assert int(http_rc.stdout) == 200
assert RunningPiHole.run('wc -l /tmp/curled_file ') > 10
assert RunningPiHole.run('grep -q "Content-Security-Policy" /tmp/curled_file ').rc == 0
assert RunningPiHole.run('grep -q "js/pihole/footer.js" /tmp/curled_file ').rc == 0