2016-11-01 05:42:08 +01:00
|
|
|
import pytest
|
2022-09-17 06:28:01 +02:00
|
|
|
|
2022-06-06 22:58:09 +02:00
|
|
|
|
2023-07-24 19:06:43 +02:00
|
|
|
@pytest.mark.parametrize("test_args", ['-e "FTLCONF_webserver_port=999"'])
|
2023-07-24 19:29:42 +02:00
|
|
|
def test_ftlconf_webserver_port(docker):
|
2023-10-20 17:04:14 +02:00
|
|
|
func = docker.run("pihole-FTL --config webserver.port")
|
|
|
|
assert "999" in func.stdout
|
2022-09-17 06:28:01 +02:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize(
|
2023-10-29 21:04:36 +01:00
|
|
|
"test_args", ['-e "FTLCONF_dns_upstreams=1.2.3.4;5.6.7.8#1234"']
|
2022-09-17 06:28:01 +02:00
|
|
|
)
|
2023-07-24 19:29:42 +02:00
|
|
|
def test_ftlconf_dns_upstreams(docker):
|
2023-10-20 17:04:14 +02:00
|
|
|
func = docker.run("pihole-FTL --config dns.upstreams")
|
|
|
|
assert "[ 1.2.3.4, 5.6.7.8#1234 ]" in func.stdout
|
|
|
|
|
|
|
|
|
|
|
|
CMD_SETUP_WEB_PASSWORD = ". bash_functions.sh ; setup_web_password"
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize("test_args", ['-e "FTLCONF_ENV_ONLY=false"'])
|
|
|
|
def test_random_password_assigned_fresh_start(docker):
|
|
|
|
func = docker.run(CMD_SETUP_WEB_PASSWORD)
|
|
|
|
assert "assigning random password:" in func.stdout
|
|
|
|
assert "New password set" in func.stdout
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
|
|
"test_args", ['-e "FTLCONF_webserver_api_password=1234567890"']
|
|
|
|
)
|
|
|
|
def test_password_set_by_envvar(docker):
|
|
|
|
func = docker.run(CMD_SETUP_WEB_PASSWORD)
|
|
|
|
assert "Assigning password defined by Environment Variable" in func.stdout
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize("test_args", ['-e "FTLCONF_ENV_ONLY=true"'])
|
|
|
|
def test_password_envonly_true(docker):
|
|
|
|
func = docker.run(CMD_SETUP_WEB_PASSWORD)
|
2022-09-17 06:28:01 +02:00
|
|
|
assert (
|
2023-10-20 17:04:14 +02:00
|
|
|
"No password supplied via FTLCONF_webserver_api_password, but FTLCONF_ENV_ONLY is set to true, using default (none)"
|
2023-07-24 19:06:43 +02:00
|
|
|
in func.stdout
|
2022-09-17 06:28:01 +02:00
|
|
|
)
|