mirror of
https://github.com/pi-hole/docker-pi-hole.git
synced 2024-06-30 05:01:00 +02:00
commit
ea0a3221de
|
@ -27,7 +27,7 @@ THIS_DIR = os.path.dirname(os.path.abspath(__file__))
|
|||
base_vars = {
|
||||
'name': 'diginc/pi-hole',
|
||||
'maintainer' : 'adam@diginc.us',
|
||||
's6_version' : 'v1.20.0.0',
|
||||
's6_version' : 'v1.21.2.1',
|
||||
}
|
||||
|
||||
os_base_vars = {
|
||||
|
|
|
@ -11,7 +11,7 @@ ENV PATH /opt/pihole:${PATH}
|
|||
COPY install.sh /usr/local/bin/docker-install.sh
|
||||
ENV setupVars /etc/pihole/setupVars.conf
|
||||
ENV PIHOLE_INSTALL /tmp/ph_install.sh
|
||||
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.20.0.0/s6-overlay-amd64.tar.gz
|
||||
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.2.1/s6-overlay-amd64.tar.gz
|
||||
|
||||
# TODO Re-enable upgrade after php5 packages use the latest greatest libressl packages, conflicts are breaking build 2017-11-14
|
||||
# RUN apk upgrade --update && \
|
||||
|
|
|
@ -11,7 +11,7 @@ ENV PATH /opt/pihole:${PATH}
|
|||
COPY install.sh /usr/local/bin/docker-install.sh
|
||||
ENV setupVars /etc/pihole/setupVars.conf
|
||||
ENV PIHOLE_INSTALL /tmp/ph_install.sh
|
||||
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.20.0.0/s6-overlay-armhf.tar.gz
|
||||
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.2.1/s6-overlay-armhf.tar.gz
|
||||
|
||||
# TODO Re-enable upgrade after php5 packages use the latest greatest libressl packages, conflicts are breaking build 2017-11-14
|
||||
# RUN apk upgrade --update && \
|
||||
|
|
|
@ -11,7 +11,7 @@ ENV PATH /opt/pihole:${PATH}
|
|||
COPY install.sh /usr/local/bin/docker-install.sh
|
||||
ENV setupVars /etc/pihole/setupVars.conf
|
||||
ENV PIHOLE_INSTALL /tmp/ph_install.sh
|
||||
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.20.0.0/s6-overlay-aarch64.tar.gz
|
||||
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.2.1/s6-overlay-aarch64.tar.gz
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y wget curl net-tools cron && \
|
||||
|
|
|
@ -11,7 +11,7 @@ ENV PATH /opt/pihole:${PATH}
|
|||
COPY install.sh /usr/local/bin/docker-install.sh
|
||||
ENV setupVars /etc/pihole/setupVars.conf
|
||||
ENV PIHOLE_INSTALL /tmp/ph_install.sh
|
||||
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.20.0.0/s6-overlay-amd64.tar.gz
|
||||
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.2.1/s6-overlay-amd64.tar.gz
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y wget curl net-tools cron && \
|
||||
|
|
|
@ -11,7 +11,7 @@ ENV PATH /opt/pihole:${PATH}
|
|||
COPY install.sh /usr/local/bin/docker-install.sh
|
||||
ENV setupVars /etc/pihole/setupVars.conf
|
||||
ENV PIHOLE_INSTALL /tmp/ph_install.sh
|
||||
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.20.0.0/s6-overlay-armhf.tar.gz
|
||||
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.2.1/s6-overlay-armhf.tar.gz
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y wget curl net-tools cron && \
|
||||
|
|
|
@ -63,10 +63,10 @@ setup_dnsmasq_dns() {
|
|||
fi
|
||||
|
||||
echo "Using $dnsType DNS servers: $DNS1 & $DNS2"
|
||||
if [[ -n "$DNS1" && -z "$setupDNS1" ]] ; then
|
||||
if [[ -n "$DNS1" && -z "$setupDNS1" ]] ; then
|
||||
change_setting "PIHOLE_DNS_1" "${DNS1}"
|
||||
fi
|
||||
if [[ -n "$DNS2" && -z "$setupDNS2" ]] ; then
|
||||
if [[ -n "$DNS2" && -z "$setupDNS2" ]] ; then
|
||||
change_setting "PIHOLE_DNS_2" "${DNS2}"
|
||||
fi
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ setup_dnsmasq_interface() {
|
|||
interfaceType='custom'
|
||||
fi;
|
||||
echo "DNSMasq binding to $interfaceType interface: $INTERFACE"
|
||||
[ -n "$INTERFACE" ] && change_setting "PIHOLE_INTERFACE" "${INTERFACE}"
|
||||
[ -n "$INTERFACE" ] && change_setting "PIHOLE_INTERFACE" "${INTERFACE}"
|
||||
}
|
||||
|
||||
setup_dnsmasq_config_if_missing() {
|
||||
|
@ -224,10 +224,10 @@ setup_web_password() {
|
|||
fi;
|
||||
set -x
|
||||
if [[ "$WEBPASSWORD" == "" ]] ; then
|
||||
echo "" | pihole -a -p
|
||||
echo "" | pihole -a -p
|
||||
else
|
||||
pihole -a -p "$WEBPASSWORD" "$WEBPASSWORD"
|
||||
fi
|
||||
pihole -a -p "$WEBPASSWORD" "$WEBPASSWORD"
|
||||
fi
|
||||
{ set +x; } 2>/dev/null
|
||||
}
|
||||
|
||||
|
@ -274,10 +274,12 @@ test_configs_alpine() {
|
|||
|
||||
test_framework_stubbing() {
|
||||
if [ -n "$PYTEST" ] ; then
|
||||
echo ":::::: Tests are being ran - stub out ad list fetching and add a fake ad block"
|
||||
sed -i 's/^gravity_spinup$/#gravity_spinup # DISABLED FOR PYTEST/g' "$(which gravity.sh)"
|
||||
echo 'testblock.pi-hole.local' >> /etc/pihole/blacklist.txt
|
||||
fi
|
||||
echo ":::::: Tests are being ran - stub out ad list fetching and add a fake ad block"
|
||||
sed -i 's/^gravity_spinup$/#gravity_spinup # DISABLED FOR PYTEST/g' "$(which gravity.sh)"
|
||||
echo '123.123.123.123 testblock.pi-hole.local' > /var/www/html/fake.list
|
||||
echo 'file:///var/www/html/fake.list' > /etc/pihole/adlists.list
|
||||
echo 'http://localhost/fake.list' >> /etc/pihole/adlists.list
|
||||
fi
|
||||
}
|
||||
|
||||
docker_main() {
|
||||
|
|
26
install.sh
26
install.sh
|
@ -1,8 +1,9 @@
|
|||
#!/bin/bash -ex
|
||||
mkdir -p /etc/pihole/
|
||||
export CORE_TAG='v3.1.4'
|
||||
export WEB_TAG='v3.1'
|
||||
export FTL_TAG='v2.11.1'
|
||||
export CORE_TAG='v3.2'
|
||||
export WEB_TAG='v3.2'
|
||||
export FTL_TAG='v2.12'
|
||||
export USE_DEVELOPMENT_BRANCHES=false
|
||||
|
||||
# Make pihole scripts fail searching for `systemctl`,
|
||||
# which fails pretty miserably in docker compared to `service`
|
||||
|
@ -45,7 +46,7 @@ if [[ "$TAG" == 'debian' ]] ; then
|
|||
# IPv6 support for nc openbsd better than traditional
|
||||
apt-get install -y --force-yes netcat-openbsd
|
||||
elif [[ "$TAG" == 'alpine' ]] ; then
|
||||
apk add \
|
||||
apk add -U \
|
||||
dnsmasq \
|
||||
nginx \
|
||||
ca-certificates \
|
||||
|
@ -59,9 +60,18 @@ piholeGitUrl="${piholeGitUrl}"
|
|||
webInterfaceGitUrl="${webInterfaceGitUrl}"
|
||||
webInterfaceDir="${webInterfaceDir}"
|
||||
git clone "${piholeGitUrl}" "${PI_HOLE_LOCAL_REPO}"
|
||||
pushd "${PI_HOLE_LOCAL_REPO}"; git reset --hard "${CORE_TAG}"; popd;
|
||||
git clone "${webInterfaceGitUrl}" "${webInterfaceDir}"
|
||||
pushd "${webInterfaceDir}"; git reset --hard "${WEB_TAG}"; popd;
|
||||
if [[ $USE_DEVELOPMENT_BRANCHES == true ]] ; then
|
||||
pushd "${PI_HOLE_LOCAL_REPO}"; git checkout development; popd;
|
||||
pushd "${webInterfaceDir}"; git checkout devel; popd;
|
||||
else
|
||||
pushd "${PI_HOLE_LOCAL_REPO}";
|
||||
git reset --hard "${CORE_TAG}";
|
||||
# Can be removed once https://github.com/pi-hole/pi-hole/pull/1779 is in a release
|
||||
git checkout 8d721d086cbe4b49665c9e0b1d81499b284776a9 gravity.sh
|
||||
popd;
|
||||
pushd "${webInterfaceDir}"; git reset --hard "${WEB_TAG}"; popd;
|
||||
fi
|
||||
|
||||
export PIHOLE_INTERFACE=eth0
|
||||
export IPV4_ADDRESS=0.0.0.0
|
||||
|
@ -70,8 +80,8 @@ export PIHOLE_DNS_1=8.8.8.8
|
|||
export PIHOLE_DNS_2=8.8.4.4
|
||||
export QUERY_LOGGING=true
|
||||
|
||||
tmpLog="${tmpLog}"
|
||||
instalLogLoc="${instalLogLoc}"
|
||||
tmpLog="/tmp/pihole-install.log"
|
||||
installLogLoc="${installLogLoc}"
|
||||
installPihole | tee "${tmpLog}"
|
||||
sed -i 's/readonly //g' /opt/pihole/webpage.sh
|
||||
if [[ "$TAG" == 'alpine' ]] ; then
|
||||
|
|
|
@ -1,235 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# Pi-hole: A black hole for Internet advertisements
|
||||
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
# Network-wide ad blocking via your own hardware.
|
||||
#
|
||||
# Whitelists and blacklists domains
|
||||
#
|
||||
# This file is copyright under the latest version of the EUPL.
|
||||
# Please see LICENSE file for your rights under this license.
|
||||
|
||||
|
||||
|
||||
#globals
|
||||
basename=pihole
|
||||
piholeDir=/etc/${basename}
|
||||
whitelist=${piholeDir}/whitelist.txt
|
||||
blacklist=${piholeDir}/blacklist.txt
|
||||
readonly wildcardlist="/etc/dnsmasq.d/03-pihole-wildcard.conf"
|
||||
reload=false
|
||||
addmode=true
|
||||
verbose=true
|
||||
|
||||
domList=()
|
||||
domToRemoveList=()
|
||||
|
||||
listMain=""
|
||||
listAlt=""
|
||||
|
||||
helpFunc() {
|
||||
|
||||
if [[ ${listMain} == ${whitelist} ]]; then
|
||||
letter="w"
|
||||
word="white"
|
||||
else
|
||||
letter="b"
|
||||
word="black"
|
||||
fi
|
||||
|
||||
cat << EOM
|
||||
::: Immediately ${word}lists one or more domains in the hosts file
|
||||
:::
|
||||
::: Usage: pihole -${letter} domain1 [domain2 ...]
|
||||
:::
|
||||
::: Options:
|
||||
::: -d, --delmode Remove domains from the ${word}list
|
||||
::: -nr, --noreload Update ${word}list without refreshing dnsmasq
|
||||
::: -q, --quiet Output is less verbose
|
||||
::: -h, --help Show this help dialog
|
||||
::: -l, --list Display your ${word}listed domains
|
||||
EOM
|
||||
if [[ "${letter}" == "b" ]]; then
|
||||
echo "::: -wild, --wildcard Add wildcard entry (only blacklist)"
|
||||
fi
|
||||
exit 0
|
||||
}
|
||||
|
||||
EscapeRegexp() {
|
||||
# This way we may safely insert an arbitrary
|
||||
# string in our regular expressions
|
||||
# Also remove leading "." if present
|
||||
echo $* | sed 's/^\.*//' | sed "s/[]\.|$(){}?+*^]/\\\\&/g" | sed "s/\\//\\\\\//g"
|
||||
}
|
||||
|
||||
HandleOther(){
|
||||
# First, convert everything to lowercase
|
||||
domain=$(sed -e "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/" <<< "$1")
|
||||
|
||||
#check validity of domain
|
||||
validDomain=$(echo "${domain}" | perl -lne 'print if /(?!.*[^a-z0-9-\.].*)^((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9-]+\.)*[a-z]{2,63}/')
|
||||
if [ -z "${validDomain}" ]; then
|
||||
echo "::: $1 is not a valid argument or domain name"
|
||||
else
|
||||
domList=("${domList[@]}" ${validDomain})
|
||||
fi
|
||||
}
|
||||
|
||||
PoplistFile() {
|
||||
#check whitelist file exists, and if not, create it
|
||||
if [[ ! -f ${whitelist} ]]; then
|
||||
touch ${whitelist}
|
||||
fi
|
||||
for dom in "${domList[@]}"; do
|
||||
# Logic : If addmode then add to desired list and remove from the other; if delmode then remove from desired list but do not add to the other
|
||||
if ${addmode}; then
|
||||
AddDomain "${dom}" "${listMain}"
|
||||
RemoveDomain "${dom}" "${listAlt}"
|
||||
if [[ "${listMain}" == "${whitelist}" || "${listMain}" == "${blacklist}" ]]; then
|
||||
RemoveDomain "${dom}" "${wildcardlist}"
|
||||
fi
|
||||
else
|
||||
RemoveDomain "${dom}" "${listMain}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
AddDomain() {
|
||||
list="$2"
|
||||
domain=$(EscapeRegexp "$1")
|
||||
|
||||
if [[ "${list}" == "${whitelist}" || "${list}" == "${blacklist}" ]]; then
|
||||
|
||||
bool=true
|
||||
#Is the domain in the list we want to add it to?
|
||||
grep -Ex -q "${domain}" "${list}" > /dev/null 2>&1 || bool=false
|
||||
|
||||
if [[ "${bool}" == false ]]; then
|
||||
#domain not found in the whitelist file, add it!
|
||||
if [[ "${verbose}" == true ]]; then
|
||||
echo "::: Adding $1 to $list..."
|
||||
fi
|
||||
reload=true
|
||||
# Add it to the list we want to add it to
|
||||
echo "$1" >> "${list}"
|
||||
else
|
||||
if [[ "${verbose}" == true ]]; then
|
||||
echo "::: ${1} already exists in ${list}, no need to add!"
|
||||
fi
|
||||
fi
|
||||
|
||||
elif [[ "${list}" == "${wildcardlist}" ]]; then
|
||||
|
||||
source "${piholeDir}/setupVars.conf"
|
||||
#Remove the /* from the end of the IPv4addr.
|
||||
IPV4_ADDRESS=${IPV4_ADDRESS%/*}
|
||||
IPV6_ADDRESS=${IPV6_ADDRESS}
|
||||
|
||||
bool=true
|
||||
#Is the domain in the list?
|
||||
grep -e "address=\/${domain}\/" "${wildcardlist}" > /dev/null 2>&1 || bool=false
|
||||
|
||||
if [[ "${bool}" == false ]]; then
|
||||
if [[ "${verbose}" == true ]]; then
|
||||
echo "::: Adding $1 to wildcard blacklist..."
|
||||
fi
|
||||
reload=true
|
||||
echo "address=/$1/${IPV4_ADDRESS}" >> "${wildcardlist}"
|
||||
if [[ ${#IPV6_ADDRESS} > 0 ]] ; then
|
||||
echo "address=/$1/${IPV6_ADDRESS}" >> "${wildcardlist}"
|
||||
fi
|
||||
else
|
||||
if [[ "${verbose}" == true ]]; then
|
||||
echo "::: ${1} already exists in wildcard blacklist, no need to add!"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
RemoveDomain() {
|
||||
list="$2"
|
||||
domain=$(EscapeRegexp "$1")
|
||||
|
||||
if [[ "${list}" == "${whitelist}" || "${list}" == "${blacklist}" ]]; then
|
||||
|
||||
bool=true
|
||||
#Is it in the list? Logic follows that if its whitelisted it should not be blacklisted and vice versa
|
||||
grep -Ex -q "${domain}" "${list}" > /dev/null 2>&1 || bool=false
|
||||
if [[ "${bool}" == true ]]; then
|
||||
# Remove it from the other one
|
||||
echo "::: Removing $1 from $list..."
|
||||
# Busybox sed compatible case-insensitive domain removal
|
||||
sed -i "$(grep -in "^${domain}$" ${list} | awk -F':' '{print $1}' | tr '\n' ',' | sed 's/,$/\n/')d" ${list}
|
||||
reload=true
|
||||
else
|
||||
if [[ "${verbose}" == true ]]; then
|
||||
echo "::: ${1} does not exist in ${list}, no need to remove!"
|
||||
fi
|
||||
fi
|
||||
|
||||
elif [[ "${list}" == "${wildcardlist}" ]]; then
|
||||
|
||||
bool=true
|
||||
#Is it in the list?
|
||||
grep -e "address=\/${domain}\/" "${wildcardlist}" > /dev/null 2>&1 || bool=false
|
||||
if [[ "${bool}" == true ]]; then
|
||||
# Remove it from the other one
|
||||
echo "::: Removing $1 from $list..."
|
||||
# Busybox sed compatible case-insensitive domain removal
|
||||
sed -i "$(grep -in "/${domain}/" ${list} | awk -F':' '{print $1}' | tr '\n' ',' | sed 's/,$/\n/')d" ${list}
|
||||
reload=true
|
||||
else
|
||||
if [[ "${verbose}" == true ]]; then
|
||||
echo "::: ${1} does not exist in ${list}, no need to remove!"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
Reload() {
|
||||
# Reload hosts file
|
||||
pihole -g -sd
|
||||
}
|
||||
|
||||
Displaylist() {
|
||||
if [[ ${listMain} == ${whitelist} ]]; then
|
||||
string="gravity resistant domains"
|
||||
else
|
||||
string="domains caught in the sinkhole"
|
||||
fi
|
||||
verbose=false
|
||||
echo -e " Displaying $string \n"
|
||||
count=1
|
||||
while IFS= read -r RD; do
|
||||
echo "${count}: ${RD}"
|
||||
count=$((count+1))
|
||||
done < "${listMain}"
|
||||
exit 0;
|
||||
}
|
||||
|
||||
for var in "$@"; do
|
||||
case "${var}" in
|
||||
"-w" | "whitelist" ) listMain="${whitelist}"; listAlt="${blacklist}";;
|
||||
"-b" | "blacklist" ) listMain="${blacklist}"; listAlt="${whitelist}";;
|
||||
"-wild" | "wildcard" ) listMain="${wildcardlist}";;
|
||||
"-nr"| "--noreload" ) reload=false;;
|
||||
"-d" | "--delmode" ) addmode=false;;
|
||||
"-f" | "--force" ) force=true;;
|
||||
"-q" | "--quiet" ) verbose=false;;
|
||||
"-h" | "--help" ) helpFunc;;
|
||||
"-l" | "--list" ) Displaylist;;
|
||||
* ) HandleOther "${var}";;
|
||||
esac
|
||||
done
|
||||
|
||||
shift
|
||||
|
||||
if [[ $# = 0 ]]; then
|
||||
helpFunc
|
||||
fi
|
||||
|
||||
PoplistFile
|
||||
|
||||
if ${reload}; then
|
||||
Reload
|
||||
fi
|
||||
|
|
@ -8,7 +8,7 @@ check_output = testinfra.get_backend(
|
|||
def DockerGeneric(request, args, image, cmd):
|
||||
assert 'docker' in check_output('id'), "Are you in the docker group?"
|
||||
if 'pi-hole' in image:
|
||||
args += " --dns 127.0.0.1 -v /dev/null:/etc/.pihole/adlists.default -e PYTEST=\"True\""
|
||||
args += " --dns 127.0.0.1 -v /dev/null:/etc/pihole/adlists.default -e PYTEST=\"True\""
|
||||
docker_run = "docker run -d {} {} {}".format(args, image, cmd)
|
||||
print docker_run
|
||||
docker_id = check_output(docker_run)
|
||||
|
|
|
@ -10,6 +10,7 @@ def RunningPiHole(DockerPersist, Slow, persist_webserver, persist_tag, start_cmd
|
|||
''' Override the RunningPiHole to run and check for success of a
|
||||
dnsmasq start based `pihole` script command '''
|
||||
#print DockerPersist.run('ps -ef').stdout
|
||||
assert DockerPersist.dig.run('ping -c 1 test_pihole').rc == 0
|
||||
Slow(lambda: DockerPersist.run('pgrep dnsmasq').rc == 0)
|
||||
Slow(lambda: DockerPersist.run('pgrep {}'.format(persist_webserver)).rc == 0)
|
||||
oldpid = DockerPersist.run('pidof dnsmasq')
|
||||
|
@ -30,15 +31,17 @@ def test_pihole_start_cmd(RunningPiHole, start_cmd, persist_tag):
|
|||
''' the start_cmd tests are all built into the RunningPiHole fixture in this file '''
|
||||
assert RunningPiHole.cmd.stdout == START_DNS_STDOUT[persist_tag]
|
||||
|
||||
@pytest.mark.parametrize('start_cmd,hostname,expected_ip, expected_message', [
|
||||
('enable', 'pi.hole', '127.0.0.1', 'enabled'),
|
||||
('disable 0', 'pi.hole', '127.0.0.1', 'disabled'),
|
||||
@pytest.mark.parametrize('start_cmd,hostname,expected_ip, expected_messages', [
|
||||
('enable', 'pi.hole', '127.0.0.1', ['Enabling blocking','Pi-hole Enabled']),
|
||||
('disable', 'pi.hole', '127.0.0.1', ['Disabling blocking','Pi-hole Disabled']),
|
||||
])
|
||||
def test_pihole_start_cmd(RunningPiHole, Dig, persist_tag, start_cmd, hostname, expected_ip, expected_message):
|
||||
def test_pihole_start_cmd(RunningPiHole, Dig, persist_tag, start_cmd, hostname, expected_ip, expected_messages):
|
||||
''' the start_cmd tests are all built into the RunningPiHole fixture in this file '''
|
||||
dig_cmd = "dig +time=1 +noall +answer {} @test_pihole | awk '{{ print $5 }}'".format(hostname)
|
||||
lookup = RunningPiHole.dig.run(dig_cmd).stdout.rstrip('\n')
|
||||
assert lookup == expected_ip
|
||||
dig_cmd = "dig +time=1 +noall +answer {} @test_pihole".format(hostname)
|
||||
lookup = RunningPiHole.dig.run(dig_cmd)
|
||||
assert lookup.rc == 0
|
||||
lookup_ip = lookup.stdout.split()[4]
|
||||
assert lookup_ip == expected_ip
|
||||
|
||||
stdout = "::: Blocking has been {}!\n".format(expected_message)
|
||||
assert stdout in RunningPiHole.cmd.stdout
|
||||
for part_of_output in expected_messages:
|
||||
assert part_of_output in RunningPiHole.cmd.stdout
|
||||
|
|
|
@ -56,7 +56,7 @@ def test_html_index_requests_load_as_expected(RunningPiHole, Slow, addr, url):
|
|||
assert http_rc.rc == 0
|
||||
assert int(http_rc.stdout) == 200
|
||||
page_contents = RunningPiHole.run('cat /tmp/curled_file ').stdout
|
||||
assert 'blocked' in page_contents
|
||||
assert 'testblock.pi-hole.local' in page_contents
|
||||
|
||||
@pytest.mark.parametrize('addr', [ 'testblock.pi-hole.local' ])
|
||||
@pytest.mark.parametrize('url', [ '/index.js', '/any.js'] )
|
||||
|
@ -65,7 +65,7 @@ def test_javascript_requests_load_as_expected(RunningPiHole, addr, url):
|
|||
http_rc = RunningPiHole.run(command)
|
||||
assert http_rc.rc == 0
|
||||
assert int(http_rc.stdout) == 200
|
||||
assert RunningPiHole.run('md5sum /tmp/curled_file /var/www/html/pihole/index.js').rc == 0
|
||||
assert 'var x = "Pi-hole: A black hole for Internet advertisements."' in RunningPiHole.run('cat /tmp/curled_file').stdout
|
||||
|
||||
# IPv6 checks aren't passing CORS, removed :(
|
||||
@pytest.mark.parametrize('addr', [ 'localhost' ] )
|
||||
|
|
Loading…
Reference in New Issue
Block a user