Do not quote params in Location header

Also treat the enum field in OPTIONS as an array uniformly
This commit is contained in:
Joe Nelson
2014-12-06 17:42:21 -08:00
parent 42faaa97c9
commit f1ecbec543
6 changed files with 44 additions and 42 deletions
-13
View File
@@ -5,19 +5,6 @@ import Test.Hspec.Wai
import SpecHelper
-- around :: (ActionWith a -> IO ()) -> SpecWith a -> Spec
-- type Spec = SpecWith ()
-- type ActionWith a = a -> IO ()
--
-- get :: ByteString -> WaiSession SResponse
-- newtype WaiSession a = WaiSession {unWaiSession :: Session a}
-- type Session = ReaderT Application (StateT ClientState IO)
--
-- type Application =
-- Request -> (Response -> IO ResponseReceived) -> IO ResponseReceived
--
-- runApp :: Request -> (Response -> IO Postgres) -> IO Postgres
spec :: Spec
spec = around withApp $ do
describe "Querying a nonexistent table" $
@@ -1,4 +1,4 @@
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE OverloadedStrings, QuasiQuotes #-}
module Feature.StructureSpec where
import Test.Hspec
@@ -13,14 +13,13 @@ import Data.Monoid ((<>))
import Data.String.Conversions (cs)
spec :: Spec
spec = let {uName = "a user"; uPass = "nobody can ever know";
uRole = "dbapi_test"} in
around withDatabaseConnection $
aroundWith (withUser uName uPass uRole) $ aroundWith withApp $ do
spec = around withApp $ do
let uName = "a user"
uPass = "nobody can ever know"
describe "GET /" $
it "lists views in schema" $
request methodGet "/"
[("Authorization", "Basic "<>(cs.encode $ cs uName<>":"<>cs uPass))] ""
[("Authorization", "Basic "<>(uName<>":"<>uPass))] ""
`shouldRespondWith` [json| [
{"schema":"1","name":"authors_only","insertable":true}
, {"schema":"1","name":"auto_incrementing_pk","insertable":true}
@@ -48,7 +47,7 @@ uRole = "dbapi_test"} in
"name": "integer",
"type": "integer",
"maxLen": null,
"enum": null,
"enum": [],
"nullable": false,
"position": 1,
"references": null,
@@ -61,7 +60,7 @@ uRole = "dbapi_test"} in
"name": "double",
"type": "double precision",
"maxLen": null,
"enum": null,
"enum": [],
"nullable": false,
"references": null,
"position": 2
@@ -73,7 +72,7 @@ uRole = "dbapi_test"} in
"name": "varchar",
"type": "character varying",
"maxLen": null,
"enum": null,
"enum": [],
"nullable": false,
"position": 3,
"references": null,
@@ -86,7 +85,7 @@ uRole = "dbapi_test"} in
"name": "boolean",
"type": "boolean",
"maxLen": null,
"enum": null,
"enum": [],
"nullable": false,
"references": null,
"position": 4
@@ -98,7 +97,7 @@ uRole = "dbapi_test"} in
"name": "date",
"type": "date",
"maxLen": null,
"enum": null,
"enum": [],
"nullable": false,
"references": null,
"position": 5
@@ -110,7 +109,7 @@ uRole = "dbapi_test"} in
"name": "money",
"type": "money",
"maxLen": null,
"enum": null,
"enum": [],
"nullable": false,
"position": 6,
"references": null,
@@ -153,7 +152,7 @@ uRole = "dbapi_test"} in
"maxLen": null,
"nullable": false,
"position": 1,
"enum": null,
"enum": [],
"references": null
}, {
"default": null,
@@ -165,7 +164,7 @@ uRole = "dbapi_test"} in
"maxLen": null,
"nullable": true,
"position": 2,
"enum": null,
"enum": [],
"references": {"table": "auto_incrementing_pk", "column": "id"}
}, {
"default": null,
@@ -177,7 +176,7 @@ uRole = "dbapi_test"} in
"maxLen": 255,
"nullable": true,
"position": 3,
"enum": null,
"enum": [],
"references": {"table": "simple_pk", "column": "k"}
}
]
+1 -1
View File
@@ -23,4 +23,4 @@ main = do
loadFixture :: FilePath -> IO()
loadFixture name =
void $ readProcess "psql" ["-U", "postgres", "-d", "dbapi_test", "-a", "-f", "test/fixtures/" ++ name ++ ".sql"] []
void $ readProcess "psql" ["-U", "dbapi_test", "-d", "dbapi_test", "-a", "-f", "test/fixtures/" ++ name ++ ".sql"] []