From 3cba6a8bfce17abdf5fa49ebbb05021e3add6954 Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Tue, 12 Jun 2007 23:21:24 +0000 Subject: [PATCH] redirect-to tests svn: r6611 --- .../web-server/tests/servlet/helpers-test.ss | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/collects/web-server/tests/servlet/helpers-test.ss b/collects/web-server/tests/servlet/helpers-test.ss index 9f606728a5..8dee162631 100644 --- a/collects/web-server/tests/servlet/helpers-test.ss +++ b/collects/web-server/tests/servlet/helpers-test.ss @@ -20,13 +20,27 @@ "Basic (succ)" (check-true (with-errors-to-browser (lambda (x) x) (lambda () #t))))) - ; XXX Test redirection status - ; XXX Test optional headers (test-suite "redirect-to" - (test-case - "Basic" - (check-pred response/full? (redirect-to "http://test.com/foo")))) + (test-equal? "Code (temp)" + (response/basic-code (redirect-to "http://test.com/foo")) + 302) + (test-equal? "Message (temp)" + (response/basic-message (redirect-to "http://test.com/foo")) + "Moved Temporarily") + (test-equal? "Code" + (response/basic-code (redirect-to "http://test.com/foo" permanently)) + 301) + (test-equal? "Message" + (response/basic-message (redirect-to "http://test.com/foo" permanently)) + "Moved Permanently") + (test-equal? "URL" + (response/basic-extras (redirect-to "http://test.com/foo")) + `((Location . "http://test.com/foo"))) + (test-equal? "Headers" + (response/basic-extras (redirect-to "http://test.com/foo" #:headers `((Header . "Value")))) + `((Location . "http://test.com/foo") + (Header . "Value")))) (test-suite "redirection-status?"