diff options
Diffstat (limited to 'tests/t0504-email-avatar.sh')
-rwxr-xr-xtests/t0504-email-avatar.sh29
1 file changed, 22 insertions, 7 deletions
diff --git a/tests/t0504-email-avatar.sh b/tests/t0504-email-avatar.sh
index 91ddc20..0150c54 100755
--- a/tests/t0504-email-avatar.sh
+++ b/tests/t0504-email-avatar.sh
@@ -3,11 +3,11 @@
# Checks email-gravatar.lua and email-libravatar.lua, the shipped email
# filters, which differ only in the service the icon is fetched from. The
# unit checks run each under every suitable standalone Lua with a
-# deterministic digest standing in for luaossl, and once more against the
-# real module wherever it is installed, which adds the check that a known
-# address hashes to its published md5. The run through cgit itself needs
-# luaossl inside the binary's own Lua, so it is probed for rather than
-# assumed.
+# deterministic digest standing in for luaossl, with the module made to
+# fail to load, and once more against the real module wherever it is
+# installed, which adds the check that a known address hashes to its
+# published md5. Through cgit itself the answer depends on whether the
+# binary's own Lua has luaossl, so it is probed for rather than assumed.
test_description='Check the shipped email avatar extensions'
CGIT_TEST_NO_CREATE_REPOS=YesPlease
@@ -25,6 +25,9 @@ do
test_expect_success "$script checks under $lua" "
'$lua' '$EXT_TEST_DIRECTORY/test-email-avatar.lua' '$EXTENSIONS_DIRECTORY/$script.lua' stub
"
+ test_expect_success "$script checks without luaossl under $lua" "
+ '$lua' '$EXT_TEST_DIRECTORY/test-email-avatar.lua' '$EXTENSIONS_DIRECTORY/$script.lua' missing
+ "
if "$lua" -e "require([[openssl.digest]])" >/dev/null 2>&1
then
@@ -49,11 +52,16 @@ if test "$CGIT_HAS_LUA" -eq 1 &&
cgit_lua_probe "$PWD/repos/avatar/.git" openssl.digest
then
test_set_prereq CGIT_LUA_OSSL
+elif test "$CGIT_HAS_LUA" -eq 1
+then
+ test_set_prereq CGIT_LUA_NOOSSL
+ say 'cgit lua has no luaossl, expecting names without icons'
else
- say 'cgit lua has no luaossl, filter checks through cgit skipped'
+ say 'cgit built without lua, filter checks through cgit skipped'
fi
+test "$CGIT_HAS_LUA" -eq 1 && test_set_prereq CGIT_LUA
-test_expect_success CGIT_LUA_OSSL 'point cgit at it through the email filter' '
+test_expect_success CGIT_LUA 'point cgit at it through the email filter' '
cat >cgitrc <<-EOF
virtual-root=/
cache-size=0
@@ -71,4 +79,11 @@ test_expect_success CGIT_LUA_OSSL 'the commit page draws the author icon' '
grep "loading=.lazy." tmp
'
+test_expect_success CGIT_LUA_NOOSSL 'without luaossl the page keeps the name alone' '
+ cgit_url "avatar/commit/" >tmp &&
+ grep "A U Thor" tmp &&
+ ! grep "<img src=.https:" tmp &&
+ ! grep "Unable to complete the request" tmp
+'
+
test_done