diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-07-07 20:18:32 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2013-07-08 00:24:20 +0300 |
commit | 4e2b6995088963e287de5dcc507a5ab14a7134b1 (patch) | |
tree | f96b3877d03693cbfd0007f4bde707cba8b89b32 /tests | |
download | vmod-basicauth-4e2b6995088963e287de5dcc507a5ab14a7134b1.tar.gz vmod-basicauth-4e2b6995088963e287de5dcc507a5ab14a7134b1.tar.bz2 |
Initial commit
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 15 | ||||
-rw-r--r-- | tests/htpasswd | 3 | ||||
-rw-r--r-- | tests/test00.vtc | 23 | ||||
-rw-r--r-- | tests/test01.vtc | 23 | ||||
-rw-r--r-- | tests/test02.vtc | 23 |
5 files changed, 87 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..4e4347b --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,15 @@ +VMOD_TESTS = \ + test00.vtc\ + test01.vtc\ + test02.vtc + +EXTRA_DIST=$(VMOD_TESTS) htpasswd + +check: + cd $(abs_srcdir); \ + for t in $(VMOD_TESTS); do \ + $(VARNISHSRC)/bin/varnishtest/varnishtest \ + -Dvarnishd=$(VARNISHSRC)/bin/varnishd/varnishd \ + -Dvmod_topsrc=$(abs_top_srcdir) \ + -Dvmod_topbuild=$(abs_top_builddir) $$t; \ + done diff --git a/tests/htpasswd b/tests/htpasswd new file mode 100644 index 0000000..5802542 --- /dev/null +++ b/tests/htpasswd @@ -0,0 +1,3 @@ +method-md5:$apr1$VMppzIb7$PyrBTfSWt4hGZhOG2WIae1 +method-crypt:.GSZ.lgnfLS1. +method-plain:guessme-plain diff --git a/tests/test00.vtc b/tests/test00.vtc new file mode 100644 index 0000000..7876677 --- /dev/null +++ b/tests/test00.vtc @@ -0,0 +1,23 @@ +varnishtest "Test basic HTTP authentication: PLAIN" + +server s1 { + rxreq + txresp +} -start + +varnish v1 -vcl+backend { + import basicauth from "${vmod_topbuild}/src/.libs/libvmod_basicauth.so"; + sub vcl_deliver { + set resp.http.result = basicauth.match("${vmod_topsrc}/tests/htpasswd", "Basic bWV0aG9kLXBsYWluOmd1ZXNzbWUtcGxhaW4="); + } +} -start + +client c1 { + txreq -url "/" + rxresp + expect resp.http.result == true +} + +client c1 -run + + diff --git a/tests/test01.vtc b/tests/test01.vtc new file mode 100644 index 0000000..f419271 --- /dev/null +++ b/tests/test01.vtc @@ -0,0 +1,23 @@ +varnishtest "Test basic HTTP authentication: CRYPT" + +server s1 { + rxreq + txresp +} -start + +varnish v1 -vcl+backend { + import basicauth from "${vmod_topbuild}/src/.libs/libvmod_basicauth.so"; + sub vcl_deliver { + set resp.http.result = basicauth.match("${vmod_topsrc}/tests/htpasswd", "Basic bWV0aG9kLWNyeXB0Omd1ZXNzbWUtY3J5cHQ="); + } +} -start + +client c1 { + txreq -url "/" + rxresp + expect resp.http.result == true +} + +client c1 -run + + diff --git a/tests/test02.vtc b/tests/test02.vtc new file mode 100644 index 0000000..a6759bd --- /dev/null +++ b/tests/test02.vtc @@ -0,0 +1,23 @@ +varnishtest "Test basic HTTP authentication: APR MD5" + +server s1 { + rxreq + txresp +} -start + +varnish v1 -vcl+backend { + import basicauth from "${vmod_topbuild}/src/.libs/libvmod_basicauth.so"; + sub vcl_deliver { + set resp.http.result = basicauth.match("${vmod_topsrc}/tests/htpasswd", "Basic bWV0aG9kLW1kNTpndWVzc21lLW1kNQ=="); + } +} -start + +client c1 { + txreq -url "/" + rxresp + expect resp.http.result == true +} + +client c1 -run + + |