Skip to content

Commit

Permalink
Add test coverage for IncludeFile
Browse files Browse the repository at this point in the history
  • Loading branch information
joecorall committed Nov 9, 2023
1 parent d465461 commit 6c66dec
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 2 additions & 0 deletions fixtures/config.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
U lts.lehigh.edu
H preserve.lehigh.edu
D lib.lehigh.edu

IncludeFile scholar.txt
3 changes: 3 additions & 0 deletions fixtures/scholar.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Title Google Scholar
URL https://scholar.google.com
Host https://scholar.google.com
12 changes: 6 additions & 6 deletions scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,33 @@ URLS=(
"https://preserve.lehigh.edu"
"https://$RANDOM.lib.lehigh.edu"
"https://$RANDOM.$RANDOM.lib.lehigh.edu"

"https://scholar.google.com"
)
for URL in "${URLS[@]}"; do
echo "Checking ${URL}"
echo -e "\tChecking ${URL}"
STATUS_CODE=$(curl -w '%{http_code}' \
-o /dev/null \
-s \
"http://localhost:8888/proxyUrl?url=$URL")
echo -e "\t${STATUS_CODE}"
echo -e "\t\t${STATUS_CODE}"
if [ ! "${STATUS_CODE}" -eq 200 ]; then
EXIT_CODE=1
fi
done

echo "Checking domains not in config throw 404s"
URLS=(
"https://scholar.google.com"
"https://lts.lehigh.COM"
"https://$RANDOM.lehigh.edu"
"https://$RANDOM.$RANDOM.lehigh.edu"
)
for URL in "${URLS[@]}"; do
echo "Checking ${URL}"
echo -e "\tChecking ${URL}"
STATUS_CODE=$(curl -w '%{http_code}' \
-o /dev/null \
-s \
"http://localhost:8888/proxyUrl?url=$URL")
echo -e "\t${STATUS_CODE}"
echo -e "\t\t${STATUS_CODE}"
if [ ! "${STATUS_CODE}" -eq 404 ]; then
EXIT_CODE=1
fi
Expand Down

0 comments on commit 6c66dec

Please sign in to comment.