alpine 3.2 startup tests fixed, web still failing

This commit is contained in:
diginc
2017-12-11 10:28:05 -06:00
parent d47442ee6e
commit d9fa9b1016
8 changed files with 69 additions and 19 deletions

View File

@@ -53,9 +53,15 @@ def test_indecies_are_present(RunningPiHole):
def test_html_index_requests_load_as_expected(RunningPiHole, Slow, addr, url):
command = 'curl -s -o /tmp/curled_file -w "%{{http_code}}" http://{}{}'.format(addr, url)
http_rc = RunningPiHole.run(command)
assert http_rc.rc == 0
assert int(http_rc.stdout) == 200
page_contents = RunningPiHole.run('cat /tmp/curled_file ').stdout
expeced_http_code = 200
if http_rc != 0 or http_rc.stdout != expected_http_code:
print 'CURL stdout: {}\nCURL stderr:{}\nCURL file:\n{}\n'.format(
http_rc.stdout, http_rc.stderr, page_contents)
assert http_rc.rc == 0
assert int(http_rc.stdout) == expected_http_code
assert 'testblock.pi-hole.local' in page_contents
@pytest.mark.parametrize('addr', [ 'testblock.pi-hole.local' ])
@@ -63,9 +69,16 @@ def test_html_index_requests_load_as_expected(RunningPiHole, Slow, addr, url):
def test_javascript_requests_load_as_expected(RunningPiHole, addr, url):
command = 'curl -s -o /tmp/curled_file -w "%{{http_code}}" http://{}{}'.format(addr, url)
http_rc = RunningPiHole.run(command)
page_contents = RunningPiHole.run('cat /tmp/curled_file ').stdout
expeced_http_code = 200
if http_rc != 0 or http_rc.stdout != expected_http_code:
print 'CURL stdout: {}\nCURL stderr:{}\nCURL file:\n{}\n'.format(
http_rc.stdout, http_rc.stderr, page_contents)
assert http_rc.rc == 0
assert int(http_rc.stdout) == 200
assert 'var x = "Pi-hole: A black hole for Internet advertisements."' in RunningPiHole.run('cat /tmp/curled_file').stdout
assert int(http_rc.stdout) == expected_http_code
assert 'var x = "Pi-hole: A black hole for Internet advertisements."' in page_contents
# IPv6 checks aren't passing CORS, removed :(
@pytest.mark.parametrize('addr', [ 'localhost' ] )
@@ -73,9 +86,15 @@ def test_javascript_requests_load_as_expected(RunningPiHole, addr, url):
def test_admin_requests_load_as_expected(RunningPiHole, addr, url):
command = 'curl -s -o /tmp/curled_file -w "%{{http_code}}" http://{}{}'.format(addr, url)
http_rc = RunningPiHole.run(command)
assert http_rc.rc == 0
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 "scripts/pi-hole/js/footer.js" /tmp/curled_file ').rc == 0
page_contents = RunningPiHole.run('cat /tmp/curled_file ').stdout
expeced_http_code = 200
if http_rc != 0 or http_rc.stdout != expected_http_code:
print 'CURL stdout: {}\nCURL stderr:{}\nCURL file:\n{}\n'.format(
http_rc.stdout, http_rc.stderr, page_contents)
assert http_rc.rc == 0
assert int(http_rc.stdout) == expected_http_code
for html_text in ['dns_queries_today', 'Content-Security-Policy', 'scripts/pi-hole/js/footer.js']:
assert html_text in page_contents