From 494734bf27f836d2e5f17df1567d79fc37ad9de0 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Sun, 28 May 2023 23:40:47 +0100 Subject: [PATCH] Add in a test case Signed-off-by: Adam Warner --- test/test_any_automated_install.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/test/test_any_automated_install.py b/test/test_any_automated_install.py index c1288287..36a4f0d2 100644 --- a/test/test_any_automated_install.py +++ b/test/test_any_automated_install.py @@ -1151,3 +1151,30 @@ def test_package_manager_has_web_deps(host): assert "No package" not in output.stdout assert output.rc == 0 + + +def test_webpage_sh_valid_domain(host): + """Confirms checkDomain function in webpage.sh works as expected""" + check1 = host.run( + """ + source /opt/pihole/webpage.sh + checkDomain "pi-hole.net" + """ + ) + check2 = host.run( + """ + source /opt/pihole/webpage.sh + checkDomain "ab.pi-hole.net" + """ + ) + + check3 = host.run( + """ + source /opt/pihole/webpage.sh + checkDomain "abc.pi-hole.net" + """ + ) + + assert "pi-hole.net" in check1.stdout + assert "ab.pi-hole.net" in check2.stdout + assert "abc.pi-hole.net" in check3.stdout