Fixing tests

This commit is contained in:
Jay McCarthy 2010-12-08 14:00:59 -07:00
parent 0c4658f718
commit 5285dc6a16

View File

@ -17,40 +17,40 @@
(if redact? (redact bs) bs))
(test
(write-response (make-xexpr-response '(a ([href "#"]) "link")))
(write-response (response/xexpr '(a ([href "#"]) "link")))
=>
#"HTTP/1.1 200 Okay\r\nDate: REDACTED GMT\r\nLast-Modified: REDACTED GMT\r\nServer: Racket\r\nContent-Type: text/html; charset=utf-8\r\nConnection: close\r\nContent-Length: 20\r\n\r\n<a href=\"#\">link</a>"
#"HTTP/1.1 200 Okay\r\nDate: REDACTED GMT\r\nLast-Modified: REDACTED GMT\r\nServer: Racket\r\nContent-Type: text/html; charset=utf-8\r\nConnection: close\r\n\r\n<a href=\"#\">link</a>"
(write-response (make-xexpr-response '(a ([href "#"]) "link")
(write-response (response/xexpr '(a ([href "#"]) "link")
#:code 404))
=>
#"HTTP/1.1 404 Okay\r\nDate: REDACTED GMT\r\nLast-Modified: REDACTED GMT\r\nServer: Racket\r\nContent-Type: text/html; charset=utf-8\r\nConnection: close\r\nContent-Length: 20\r\n\r\n<a href=\"#\">link</a>"
#"HTTP/1.1 404 Okay\r\nDate: REDACTED GMT\r\nLast-Modified: REDACTED GMT\r\nServer: Racket\r\nContent-Type: text/html; charset=utf-8\r\nConnection: close\r\n\r\n<a href=\"#\">link</a>"
(write-response (make-xexpr-response '(a ([href "#"]) "link")
(write-response (response/xexpr '(a ([href "#"]) "link")
#:message #"Bad request"))
=>
#"HTTP/1.1 200 Bad request\r\nDate: REDACTED GMT\r\nLast-Modified: REDACTED GMT\r\nServer: Racket\r\nContent-Type: text/html; charset=utf-8\r\nConnection: close\r\nContent-Length: 20\r\n\r\n<a href=\"#\">link</a>"
#"HTTP/1.1 200 Bad request\r\nDate: REDACTED GMT\r\nLast-Modified: REDACTED GMT\r\nServer: Racket\r\nContent-Type: text/html; charset=utf-8\r\nConnection: close\r\n\r\n<a href=\"#\">link</a>"
(regexp-replace
#"Date: [a-zA-Z0-9:, ]+ GMT\r\n"
(write-response (make-xexpr-response '(a ([href "#"]) "link")
(write-response (response/xexpr '(a ([href "#"]) "link")
#:seconds 0)
#f)
#"Date: REDACTED GMT\r\n")
=>
#"HTTP/1.1 200 Okay\r\nDate: REDACTED GMT\r\nLast-Modified: Thu, 01 Jan 1970 00:00:00 GMT\r\nServer: Racket\r\nContent-Type: text/html; charset=utf-8\r\nConnection: close\r\nContent-Length: 20\r\n\r\n<a href=\"#\">link</a>"
#"HTTP/1.1 200 Okay\r\nDate: REDACTED GMT\r\nLast-Modified: Thu, 01 Jan 1970 00:00:00 GMT\r\nServer: Racket\r\nContent-Type: text/html; charset=utf-8\r\nConnection: close\r\n\r\n<a href=\"#\">link</a>"
(write-response (make-xexpr-response '(a ([href "#"]) "link")
(write-response (response/xexpr '(a ([href "#"]) "link")
#:mime-type #"application/xml"))
=>
#"HTTP/1.1 200 Okay\r\nDate: REDACTED GMT\r\nLast-Modified: REDACTED GMT\r\nServer: Racket\r\nContent-Type: application/xml\r\nConnection: close\r\nContent-Length: 20\r\n\r\n<a href=\"#\">link</a>"
#"HTTP/1.1 200 Okay\r\nDate: REDACTED GMT\r\nLast-Modified: REDACTED GMT\r\nServer: Racket\r\nContent-Type: application/xml\r\nConnection: close\r\n\r\n<a href=\"#\">link</a>"
(write-response (make-xexpr-response '(a ([href "#"]) "link")
(write-response (response/xexpr '(a ([href "#"]) "link")
#:headers (list (header #"head" #"value"))))
=>
#"HTTP/1.1 200 Okay\r\nDate: REDACTED GMT\r\nLast-Modified: REDACTED GMT\r\nServer: Racket\r\nContent-Type: text/html; charset=utf-8\r\nConnection: close\r\nContent-Length: 20\r\nhead: value\r\n\r\n<a href=\"#\">link</a>"
#"HTTP/1.1 200 Okay\r\nDate: REDACTED GMT\r\nLast-Modified: REDACTED GMT\r\nServer: Racket\r\nContent-Type: text/html; charset=utf-8\r\nConnection: close\r\nhead: value\r\n\r\n<a href=\"#\">link</a>"
(write-response (make-xexpr-response '(a ([href "#"]) "link")
(write-response (response/xexpr '(a ([href "#"]) "link")
#:preamble #"<<!something XMLy>>"))
=>
#"HTTP/1.1 200 Okay\r\nDate: REDACTED GMT\r\nLast-Modified: REDACTED GMT\r\nServer: Racket\r\nContent-Type: text/html; charset=utf-8\r\nConnection: close\r\nContent-Length: 39\r\n\r\n<<!something XMLy>><a href=\"#\">link</a>")
#"HTTP/1.1 200 Okay\r\nDate: REDACTED GMT\r\nLast-Modified: REDACTED GMT\r\nServer: Racket\r\nContent-Type: text/html; charset=utf-8\r\nConnection: close\r\n\r\n<<!something XMLy>><a href=\"#\">link</a>")