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:
parent
c3de49f154
commit
da44042bd4
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user