mirror of
https://github.com/chubin/wttr.in
synced 2024-11-14 16:17:19 +00:00
added some tests
This commit is contained in:
parent
71b3a70e02
commit
8695664f57
4 changed files with 136 additions and 0 deletions
1
test/proxy-data/data1
Normal file
1
test/proxy-data/data1
Normal file
File diff suppressed because one or more lines are too long
1
test/proxy-data/data1.headers
Normal file
1
test/proxy-data/data1.headers
Normal file
|
@ -0,0 +1 @@
|
|||
{"Content-Type": "application/json"}
|
66
test/query.sh
Normal file
66
test/query.sh
Normal file
|
@ -0,0 +1,66 @@
|
|||
queries=(
|
||||
/
|
||||
/Kiev
|
||||
/Kiev.png
|
||||
/?T
|
||||
/Киев
|
||||
/Kiev?2
|
||||
"/Kiev?format=1"
|
||||
"/Kiev?format=2"
|
||||
"/Kiev?format=3"
|
||||
"/Kiev?format=4"
|
||||
"/Kiev?format=v2"
|
||||
"/:help"
|
||||
"/Kiev?T"
|
||||
"/Kiev?p"
|
||||
"/Kiev?q"
|
||||
"/Kiev?Q"
|
||||
"/Kiev_text=no_view=v2.png"
|
||||
)
|
||||
|
||||
options=$(cat <<EOF
|
||||
|
||||
-A firefox
|
||||
-H Accept-Language:ru
|
||||
-H X-Forwarded-For:1.1.1.1
|
||||
EOF
|
||||
)
|
||||
|
||||
server="http://127.0.0.1:8002"
|
||||
|
||||
if [ "$1" = update ]; then
|
||||
UPDATE=yes
|
||||
fi
|
||||
|
||||
if [[ $UPDATE = yes ]]; then
|
||||
true > test-data/signatures
|
||||
fi
|
||||
|
||||
result_tmp=$(mktemp wttrin-test-XXXXX)
|
||||
|
||||
while read -r -a args
|
||||
do
|
||||
for q in "${queries[@]}"; do
|
||||
signature=$(echo "${args[@]}" "$q" | sha1sum | awk '{print $1}')
|
||||
curl -ks "${args[@]}" "$server$q" > "$result_tmp"
|
||||
|
||||
result=$(sha1sum "$result_tmp" | awk '{print $1}')
|
||||
|
||||
# this must be moved to the server
|
||||
# but for the moment we just clean up
|
||||
# the cache after each call
|
||||
rm -rf "/wttr.in/cache"
|
||||
|
||||
if grep -Eq "(we are running out of queries|500 Internal Server Error)" "$result_tmp"; then
|
||||
echo "$q"
|
||||
fi
|
||||
|
||||
if [[ $UPDATE = yes ]]; then
|
||||
printf "%s %s %s\\n" "$signature" "$result" "${args[*]} $q" >> test-data/signatures
|
||||
elif ! grep -q "$signature $result" test-data/signatures; then
|
||||
echo "FAILED: curl -ks ${args[*]} $server$q"
|
||||
fi
|
||||
done
|
||||
done <<< "${options}"
|
||||
|
||||
rm "$result_tmp"
|
68
test/test-data/signatures
Normal file
68
test/test-data/signatures
Normal file
|
@ -0,0 +1,68 @@
|
|||
8f27084b6294ddbe28dbcbf98f798730e8a79289 371718f3918eb35adeb2cfe8f6fbc52adef39520 /
|
||||
ae537911bb7b0568f478073e661abee1cb4ff941 d123e570da22dee9798d353c4281cb5a2bdbaeac /Kiev
|
||||
4dc586807c16020b9f4dbb705326c698bea41665 a186d89e95061a7887c005ffa8bd1e29362de2da /Kiev.png
|
||||
3db1938bedc0ee0047bf3b043ddaf0aba1912f13 b85ed0c0c0214016eabdcc0283e7b8f4f682f5a9 /?T
|
||||
2cc0ba7a57a6342e72fd7142ca18dbb0eae69416 ce7fb7a88cab697f5280ddabf344f0d397888956 /Киев
|
||||
928142e88da142ea8075cbfe09bfef349e72dbb1 0f86f59a45b4485fea1375ca945503d9abb9a96d /Kiev?2
|
||||
4f6f0a16ff415fad1c102c8023c5d8365ef63402 16d85d2b01441f40b1a60f45603800923580b971 /Kiev?format=1
|
||||
c99903b86971ccccfcca4f13e6fca72776b4fbcf bd4c56b36d0c86e805702b5e6c71ba2b1cbf93c1 /Kiev?format=2
|
||||
2a0d6cd8d30a84328580611ca6dd6bed1d805a04 b9a5df200b9dd035d2fee4add1a938f621b2aa98 /Kiev?format=3
|
||||
4e4e15eeb6a8b6ddb5d00591c4b5e9b74a13e6bc c31ccd5f70ef1f317ff4ad99de5b6b9affaceb39 /Kiev?format=4
|
||||
a27d3e4ad7f820124ef57c9299715bc61cb71387 18afd7989100da758f68add862b0a2730e0c79f2 /Kiev?format=v2
|
||||
83cc0ef08c24ad7ecc81d1a6cbd693bb06214ece 212431752d0b0d21fabf073e98efa3f1bc24e76e /:help
|
||||
310b64f65fc9f66a5142bf6104f4f9b9d5eef0ea b0bd07f0c87aae9464c091ccb955f41ec6973098 /Kiev?T
|
||||
9bd1b460d4927df24724f45f69bd3132f3de8e04 d001bf6ab36b6c14f98f02fc4500706d7a9f05a8 /Kiev?p
|
||||
3ee1a25d436799804d7ebd8371d8022fa55a71d7 80f18be012d0471dce9fcd2b500f482bcd635347 /Kiev?q
|
||||
e0e8e7eca16bfac88503ac6d19a7a6c8b469c0fd d5d070c98237f0dffc82b176039f90a15f03a667 /Kiev?Q
|
||||
d08d1fa2546fee0717d1eb663cf63cd1505b8885 5ccbb4c950bac7f33f1996af856f9678a4a47199 /Kiev_text=no_view=v2.png
|
||||
3e1be80e942a2ea5450c60e1c0ebfb154aca3da1 76bdcb958640233fa0048bb14c9245f18b14f7c4 -A firefox /
|
||||
ee6bf0665c2719cda3ec1fbdb80413d821c99b8e 3f9c5091269ece259cce13fc842265019001ed54 -A firefox /Kiev
|
||||
98ef11678b7fd33425f97eeee70e00cd96206539 a186d89e95061a7887c005ffa8bd1e29362de2da -A firefox /Kiev.png
|
||||
ecbcf2cb9004a754c4559ce7e92fead68f71721a bfd43c9cb44736e26752741ab2f500f9ca06da1e -A firefox /?T
|
||||
74206d869128383dba2d840b848b90eb376fd851 7c6ce53ff25d91a5f46baa30077b69e0f09f2571 -A firefox /Киев
|
||||
91b89025b5acd56ca475924e0eb559a9734f3333 dbd49d93eff2b2cf82f7d266f90de950207a0561 -A firefox /Kiev?2
|
||||
e6cb82dab95e05167ffbcb90a10d6cb03cd02ec1 16d85d2b01441f40b1a60f45603800923580b971 -A firefox /Kiev?format=1
|
||||
e65bc57e8d1df26c442a9ecf45afee390ff331a3 bd4c56b36d0c86e805702b5e6c71ba2b1cbf93c1 -A firefox /Kiev?format=2
|
||||
d743b331d5f4c81bbc8b168ce84a99ab22dc70cf b9a5df200b9dd035d2fee4add1a938f621b2aa98 -A firefox /Kiev?format=3
|
||||
bf359ee92690c3a3061542dc6e78cb42ca837412 c31ccd5f70ef1f317ff4ad99de5b6b9affaceb39 -A firefox /Kiev?format=4
|
||||
cb875772a6610c991b95b3fbfa22fc7192e25843 9b8e68e9701097316bdacfb13b0c07df23fc0aee -A firefox /Kiev?format=v2
|
||||
d520af45b491689d53024c696955db8b1e4eaa87 a76e0c26bac17e43af879db6cb11a3cd9eda2344 -A firefox /:help
|
||||
6b80492b79a4cc510cb4a9654cb6ff085cdc1943 801d4c6d6837c9604944168a3930dfe05b0e9f5d -A firefox /Kiev?T
|
||||
e13d7449ce756e55ba3e84e4b7e601b36d0044b6 c5a87804710ab70b8798f56579d276f4ce1806bf -A firefox /Kiev?p
|
||||
3f6c192a6da5b79ea59ef94e99b9cbf4b0e7ede2 372aca50f441920ad623d62ee8fcde46d609f6f9 -A firefox /Kiev?q
|
||||
f28ca2a7a47f4859eac7d0307ec7ac67a40e0adf 1b4b66d58bd7e27abeeca45581e686f12fefe76a -A firefox /Kiev?Q
|
||||
62c5029cf297b1434c57228dc8c8cdfb5e68285d 5ccbb4c950bac7f33f1996af856f9678a4a47199 -A firefox /Kiev_text=no_view=v2.png
|
||||
ed573b89ca5522d6ab69dc1686b98b00391076bd 9cd1b364c12acd74899ae34bfb9731f70b0b9b68 -H Accept-Language:ru /
|
||||
b879673f66235bbf1913ff9abc58aff2fb8962d1 00a96a5d83608c2dad7921862bb3f244775f6b19 -H Accept-Language:ru /Kiev
|
||||
83d99896cf866ecbaa6d2c64c12bd31bc7b35068 92dc07acb93633974eaff19e8c1a99e590e140d9 -H Accept-Language:ru /Kiev.png
|
||||
9cbb6aa3e0b46e78229a32688db1cced9a44271d 1f82fb278d40520b4c1ef7378e1a5abc868c1f3e -H Accept-Language:ru /?T
|
||||
095d8d38c667923131801595b903e007b5f902f3 4ede3397f9def696adc7ecf3ffd46a59b8fb25cb -H Accept-Language:ru /Киев
|
||||
4e6cdfc38c9d9f2436438b345776c42cb8cab8a5 1b00c96a05f9daea8248a8e063d990797be933ad -H Accept-Language:ru /Kiev?2
|
||||
b7d8d0f0bb4c38aabac468c9a354bb4e2b401893 c97ca64c11eaa714b472bf723a3353abd4c5bd09 -H Accept-Language:ru /Kiev?format=1
|
||||
8f3bbfc9be6418e82edacecc54a9f3e9f26b7fbf 8a29f5bf1e412e2942a701b88dfcf382072b3f34 -H Accept-Language:ru /Kiev?format=2
|
||||
f1d4178892fd3dc38e9f966112d317859acc9122 8181bd5a0d7fff5b420d480160b9ea0e14d45aeb -H Accept-Language:ru /Kiev?format=3
|
||||
cf44e154504d9bc2b9b6066bbb0f5d52fc12f13e daca309c8ef168b97998e86dbbaab2d3963495b8 -H Accept-Language:ru /Kiev?format=4
|
||||
4955c849f67da53203b8c96b15a0bf0a4a471bc6 03afac96b43c7f1b2622b1015b8a4a3cb721c50a -H Accept-Language:ru /Kiev?format=v2
|
||||
3f69f4a605ce88643b4e0d62a588c92625d41aea 237e5cf3a0f4737df49d8382fc8a84f41603cbe5 -H Accept-Language:ru /:help
|
||||
08553ca4bf71c738c4321fe7d84b4e6ff830956f 016fc03b18a8902f838719bbc171184603c08b60 -H Accept-Language:ru /Kiev?T
|
||||
b70f8b3fc8aee126c04b27b0d3b4c503b4292cbf b60b68a9e77275884812f7e52b06f6012ba5682a -H Accept-Language:ru /Kiev?p
|
||||
400efdba61125f8cb850d7c33caf4fc2739a960b 5ee4a043a91509ef57aec46a14a0c24f09e8ec47 -H Accept-Language:ru /Kiev?q
|
||||
b9fd454e73343f262a6d99dd80487495bd647c6f a10718896a07baadb87adf2bf0026b1f00252213 -H Accept-Language:ru /Kiev?Q
|
||||
8fed034e57624d0e0b33140673094e56e04087bc c7367485784883041c62f4c284aeacf690df71b4 -H Accept-Language:ru /Kiev_text=no_view=v2.png
|
||||
3ce3dd46413f236244410f142a4b44356a0cedf9 1c2eea391b35c8bfed2541435e1788307aa06bc1 -H X-Forwarded-For:1.1.1.1 /
|
||||
89be0a5787592298ce34f10b36da7ee87d1a1353 d123e570da22dee9798d353c4281cb5a2bdbaeac -H X-Forwarded-For:1.1.1.1 /Kiev
|
||||
a9977eadc628b1ede5d4f91ee103dfb740caa2b1 a186d89e95061a7887c005ffa8bd1e29362de2da -H X-Forwarded-For:1.1.1.1 /Kiev.png
|
||||
eec20c6be5e528967cddf6d0b72c84dbda553d43 9a39dbafa7e1550d374e38059c0f4b8f437e1739 -H X-Forwarded-For:1.1.1.1 /?T
|
||||
e304153f0e1e9b41781bf4eb6fb6c4a5b7513aec ce7fb7a88cab697f5280ddabf344f0d397888956 -H X-Forwarded-For:1.1.1.1 /Киев
|
||||
98f0b3a28863a861c6ac6d89ee5d49adb7f3f518 0f86f59a45b4485fea1375ca945503d9abb9a96d -H X-Forwarded-For:1.1.1.1 /Kiev?2
|
||||
cf04d7fe2cf36eba8d7fb4fa6def1c9015036456 16d85d2b01441f40b1a60f45603800923580b971 -H X-Forwarded-For:1.1.1.1 /Kiev?format=1
|
||||
67fbe9168566709450eb35d36c60c27105335a7e bd4c56b36d0c86e805702b5e6c71ba2b1cbf93c1 -H X-Forwarded-For:1.1.1.1 /Kiev?format=2
|
||||
b2604348bf39774c85b7c18ae7b51f63a2c9f31a b9a5df200b9dd035d2fee4add1a938f621b2aa98 -H X-Forwarded-For:1.1.1.1 /Kiev?format=3
|
||||
cf012400156c842e569b6a9f05b094e6b75348cd c31ccd5f70ef1f317ff4ad99de5b6b9affaceb39 -H X-Forwarded-For:1.1.1.1 /Kiev?format=4
|
||||
1f4981348cab19df9846cd3b3923ee7a972ff9fa 18afd7989100da758f68add862b0a2730e0c79f2 -H X-Forwarded-For:1.1.1.1 /Kiev?format=v2
|
||||
767a7407c14049fd77a6a2fedd1d8b35f6e47e0d 212431752d0b0d21fabf073e98efa3f1bc24e76e -H X-Forwarded-For:1.1.1.1 /:help
|
||||
10631d55b42e7bc5ec15ffc5cddae712785eb354 b0bd07f0c87aae9464c091ccb955f41ec6973098 -H X-Forwarded-For:1.1.1.1 /Kiev?T
|
||||
031478f562663eb9f577b04032993e2f098146f6 d001bf6ab36b6c14f98f02fc4500706d7a9f05a8 -H X-Forwarded-For:1.1.1.1 /Kiev?p
|
||||
e106cd21a6b67196159c2baa023142e3a8859612 80f18be012d0471dce9fcd2b500f482bcd635347 -H X-Forwarded-For:1.1.1.1 /Kiev?q
|
||||
1a16c9b52ba90cb7ad3dd8902bf41b31a287d49e d5d070c98237f0dffc82b176039f90a15f03a667 -H X-Forwarded-For:1.1.1.1 /Kiev?Q
|
||||
83bd9cc6a646e44b75524474dd32f0fd1f5c5a39 5ccbb4c950bac7f33f1996af856f9678a4a47199 -H X-Forwarded-For:1.1.1.1 /Kiev_text=no_view=v2.png
|
Loading…
Reference in a new issue