racket/collects/web-server/tests/servlet/basic-auth-test.ss
Eli Barzilay 7d50e61c7f * Newlines at EOFs
* Another big chunk of v4-require-isms
* Allow `#lang framework/keybinding-lang' for keybinding files
* Move hierlist sources into "mrlib/hierlist", leave stub behind

svn: r10689
2008-07-09 07:18:06 +00:00

28 lines
884 B
Scheme

#lang scheme/base
(require (planet "test.ss" ("schematics" "schemeunit.plt" 2))
web-server/private/request-structs
web-server/servlet/basic-auth)
(provide basic-auth-tests)
(define basic-auth-tests
(test-suite
"BASIC Authentication"
(test-case
"Simple"
(check-equal? (extract-user-pass (list (make-header #"Authorization" #"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==")))
(cons #"Aladdin" #"open sesame")))
(test-case
"Value error"
(check-false (extract-user-pass (list (make-header #"Authorization" #"Basic adfadQWxhZGRpb124134jpvcGVu=")))))
(test-case
"No header"
(check-false (extract-user-pass (list))))
(test-case
"Case"
(check-equal? (extract-user-pass (list (make-header #"AuthoRIZation" #"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==")))
(cons #"Aladdin" #"open sesame")))))