From b90c1da006488deb1c9c7fddcdb03d16370d128f Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Fri, 7 Nov 2008 17:23:56 +0000 Subject: [PATCH] New tests for password stuff svn: r12343 --- .../configuration/configuration-table-test.ss | 40 +++++++++++++++++++ .../dispatchers/dispatch-passwords-test.ss | 6 +++ 2 files changed, 46 insertions(+) diff --git a/collects/tests/web-server/configuration/configuration-table-test.ss b/collects/tests/web-server/configuration/configuration-table-test.ss index 6b335a4333..fb48463129 100644 --- a/collects/tests/web-server/configuration/configuration-table-test.ss +++ b/collects/tests/web-server/configuration/configuration-table-test.ss @@ -19,6 +19,46 @@ (read-configuration-table default-configuration-table-path) (make-temporary-file)))) + (test-case + "False allowed in configuration file for passwords" + (let ([false-sexpr + `((port 80) + (max-waiting 40) + (initial-connection-timeout 30) + (default-host-table + (host-table + (default-indices "index.html" "index.htm") + (log-format parenthesized-default) + (messages + (servlet-message "servlet-error.html") + (authentication-message "forbidden.html") + (servlets-refreshed "servlet-refresh.html") + (passwords-refreshed "passwords-refresh.html") + (file-not-found-message "not-found.html") + (protocol-message "protocol-error.html") + (collect-garbage "collect-garbage.html")) + (timeouts + (default-servlet-timeout 30) + (password-connection-timeout 300) + (servlet-connection-timeout 86400) + (file-per-byte-connection-timeout 1/20) + (file-base-connection-timeout 30)) + (paths + (configuration-root "conf") + (host-root ".") + (log-file-path "log") + (file-root "htdocs") + (servlet-root ".") + (mime-types "mime.types") + (password-authentication #f)))) + (virtual-host-table))]) + (check-equal? + (configuration-table->sexpr + (sexpr->configuration-table + false-sexpr)) + false-sexpr))) + + (test-case "Default configuration file may be converted to sexpr and back" (check-not-false diff --git a/collects/tests/web-server/dispatchers/dispatch-passwords-test.ss b/collects/tests/web-server/dispatchers/dispatch-passwords-test.ss index 597f7d0e50..c1a98ab1c6 100644 --- a/collects/tests/web-server/dispatchers/dispatch-passwords-test.ss +++ b/collects/tests/web-server/dispatchers/dispatch-passwords-test.ss @@ -62,6 +62,12 @@ "Distribution file parses" (read-passwords default-passwords)) + (test-exn + "False not allowed as password-file" + exn? + (lambda () + (passwords:password-file->authorized? #f))) + (test-exn "authorized" exn:dispatcher? (lambda () (runt #t #t)))