wai-test 0.0.0 → 0.1.0
raw patch · 2 files changed
+17/−14 lines, 2 filesdep +case-insensitivedep +http-typesdep ~blaze-builderdep ~cookiedep ~enumeratorPVP ok
version bump matches the API change (PVP)
Dependencies added: case-insensitive, http-types
Dependency ranges changed: blaze-builder, cookie, enumerator, wai
API changes (from Hackage documentation)
- Network.Wai.Test: SResponse :: Status -> [(CIByteString, ByteString)] -> ByteString -> SResponse
+ Network.Wai.Test: SResponse :: Status -> ResponseHeaders -> ByteString -> SResponse
- Network.Wai.Test: assertHeader :: CIByteString -> ByteString -> SResponse -> Session ()
+ Network.Wai.Test: assertHeader :: CI ByteString -> ByteString -> SResponse -> Session ()
- Network.Wai.Test: assertNoHeader :: CIByteString -> SResponse -> Session ()
+ Network.Wai.Test: assertNoHeader :: CI ByteString -> SResponse -> Session ()
- Network.Wai.Test: simpleHeaders :: SResponse -> [(CIByteString, ByteString)]
+ Network.Wai.Test: simpleHeaders :: SResponse -> ResponseHeaders
Files
- Network/Wai/Test.hs +10/−9
- wai-test.cabal +7/−5
Network/Wai/Test.hs view
@@ -18,18 +18,19 @@ import Network.Wai import qualified Test.HUnit.Base as H import Control.Monad.IO.Class (liftIO)-import Control.Monad.Trans.Class (lift)-import Control.Monad.Trans.State (StateT, evalStateT, get, put)+import Control.Monad.Trans.State (StateT, evalStateT) import Control.Monad.Trans.Reader (ReaderT, runReaderT, ask) import Data.Map (Map) import qualified Data.Map as Map import Data.ByteString (ByteString)-import qualified Data.ByteString as S import qualified Data.ByteString.Char8 as S8-import Data.Enumerator (joinI, consume, ($$), run_, enumList)+import Data.Enumerator (joinI, ($$), run_, enumList)+import Data.Enumerator.List (consume) import Blaze.ByteString.Builder.Enumerator (builderToByteString) import qualified Data.ByteString.Lazy as L import qualified Data.ByteString.Lazy.Char8 as L8+import qualified Network.HTTP.Types as H+import Data.CaseInsensitive (CI) type Session = ReaderT Application (StateT ClientState IO) @@ -48,8 +49,8 @@ , simpleRequestBody :: L.ByteString } data SResponse = SResponse- { simpleStatus :: Status- , simpleHeaders :: [(CIByteString, ByteString)]+ { simpleStatus :: H.Status+ , simpleHeaders :: H.ResponseHeaders , simpleBody :: L.ByteString } deriving (Show, Eq)@@ -103,7 +104,7 @@ , show sc ]) $ i == sc where- sc = statusCode s+ sc = H.statusCode s assertBody :: L.ByteString -> SResponse -> Session () assertBody lbs SResponse{simpleBody = lbs'} = assertBool (concat@@ -113,7 +114,7 @@ , show $ L8.unpack lbs' ]) $ lbs == lbs' -assertHeader :: CIByteString -> S.ByteString -> SResponse -> Session ()+assertHeader :: CI ByteString -> ByteString -> SResponse -> Session () assertHeader header value SResponse{simpleHeaders = h} = case lookup header h of Nothing -> assertString $ concat@@ -132,7 +133,7 @@ , show value' ]) (value == value') -assertNoHeader :: CIByteString -> SResponse -> Session ()+assertNoHeader :: CI ByteString -> SResponse -> Session () assertNoHeader header SResponse{simpleHeaders = h} = case lookup header h of Nothing -> return ()
wai-test.cabal view
@@ -1,5 +1,5 @@ name: wai-test-version: 0.0.0+version: 0.1.0 license: BSD3 license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>@@ -13,15 +13,17 @@ library build-depends: base >= 4 && < 5- , wai >= 0.3 && < 0.4+ , wai >= 0.4 && < 0.5 , bytestring >= 0.9.1.4 && < 0.10- , blaze-builder >= 0.2.1 && < 0.3+ , blaze-builder >= 0.2.1 && < 0.4 , transformers >= 0.2 && < 0.3 , containers >= 0.2 && < 0.5- , enumerator >= 0.4 && < 0.5- , cookie >= 0.0 && < 0.1+ , enumerator >= 0.4.7 && < 0.5+ , cookie >= 0.2 && < 0.3 , blaze-builder-enumerator >= 0.2 && < 0.3 , HUnit >= 1.2 && < 1.3+ , http-types >= 0.6 && < 0.7+ , case-insensitive >= 0.2 && < 0.3 exposed-modules: Network.Wai.Test ghc-options: -Wall