smalltalk
/
osmo-st-all
Archived
1
0
Fork 0

Added RequestHandlerTest

This commit is contained in:
Sébastien Audier 2009-08-21 22:02:20 +00:00
parent f3ba9e8212
commit f9c3509a86
1 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,39 @@
TestCase subclass: RequestHandlerTest [
| requestHandler response |
<comment: nil>
<category: 'Iliad-Tests-RequestHandlers'>
setUp [
requestHandler := RequestHandler new.
response := Response new
]
testAddAllowHeaderTo [
| methods headers |
methods := 'OPTIONS,GET,HEAD,POST,DELETE,TRACE,PROPFIND,PROPPATCH,MKCOL,PUT,COPY,MOVE,LOCK,UNLOCK'.
requestHandler addAllowHeaderTo: response.
headers := response headers.
self assert: ((Dictionary newFrom: headers) at: 'Allow') = methods
]
testAddCacheHeaderTo [
| timeStamp headers |
timeStamp := Support rfc1123StringFor: (TimeStamp
fromSeconds: TimeStamp now asSeconds + (24 * 3600)).
requestHandler addCacheHeaderTo: response.
headers := response headers.
self assert: ((Dictionary newFrom: headers) at: 'expires') = timeStamp
]
testAddNoCacheHeaderTo [
| timeStamp headers |
timeStamp := Support rfc1123StringFor: TimeStamp now.
requestHandler addNoCacheHeaderTo: response.
headers := response headers.
self assert: ((Dictionary newFrom: headers) at: 'expires') = timeStamp.
self assert: ((Dictionary newFrom: headers) at: 'Cache-Control')
= 'no-store, no-cache, must-revalidate'
]
]