File: 11-local-footer-nested.test

package info (click to toggle)
libnginx-mod-http-fancyindex 1%3A0.5.2-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 340 kB
  • sloc: ansic: 1,296; sh: 588; awk: 36; makefile: 3
file content (31 lines) | stat: -rw-r--r-- 1,012 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#! /bin/bash
cat <<---
This test checks that local footers are correctly included in presence of
directives in nested locations:

	fancyindex_footer <one> local;
	location /sub {
		fancyindex_footer <another> local;
	}

--
use pup

echo '<div id="topfooter">yes</div>' > "${TESTDIR}/top-footer"
echo '<div id="subfooter">yes</div>' > "${TESTDIR}/sub-footer"

nginx_start "fancyindex_footer \"${TESTDIR}/top-footer\" local;
             location /child-directory {
			    fancyindex_footer \"${TESTDIR}/sub-footer\" local;
			 }"

T=$(fetch /)
echo "$T" > "$TESTDIR/top.html"
[[ $(pup -p body 'div#topfooter' text{} <<< "$T") = yes ]] || fail 'Custom header missing at /'
[[ -z $(pup -p body 'div#subfooter' text{} <<< "$T") ]] || fail 'Wrong header at /'

T=$(fetch /child-directory/)
[[ $(pup -p body 'div#subfooter' text{} <<< "$T") = yes ]] || fail 'Custom header missing at /sub/'
[[ -z $(pup -p body 'div#topfooter' text{} <<< "$T") ]] || fail 'Wrong header at /sub/'

nginx_is_running || fail 'Nginx died'