Test failed post, and clean up specs
This commit is contained in:
@@ -33,7 +33,7 @@ instance JSON.FromJSON IncPK where
|
||||
spec :: Spec
|
||||
spec = around appWithFixture $
|
||||
describe "Posting new record" $
|
||||
context "with no pk supplied" $
|
||||
context "with no pk supplied" $ do
|
||||
context "into a table with auto-incrementing pk" $
|
||||
it "succeeds with 201 and link" $ do
|
||||
post "/auto_incrementing_pk" [json| { "non_nullable_string":"not null"} |]
|
||||
@@ -47,3 +47,8 @@ spec = around appWithFixture $
|
||||
liftIO $ do
|
||||
incStr record `shouldBe` "not null"
|
||||
incNullableStr record `shouldBe` Nothing
|
||||
|
||||
context "into a table with simple pk" $
|
||||
it "fails with 400 and error" $
|
||||
post "/contacts" [json| { "name":"J Doe"} |]
|
||||
`shouldRespondWith` 400
|
||||
|
||||
@@ -11,62 +11,6 @@ import Network.HTTP.Types
|
||||
|
||||
spec :: Spec
|
||||
spec = around appWithFixture $ do
|
||||
describe "GET /" $ do
|
||||
it "responds with 200" $
|
||||
get "/" `shouldRespondWith` 200
|
||||
|
||||
it "lists views in schema" $
|
||||
get "/" `shouldRespondWith` [json|
|
||||
[{"schema":"1","name":"auto_incrementing_pk","insertable":true}]
|
||||
|]
|
||||
|
||||
describe "Table info" $
|
||||
it "is available with OPTIONS verb" $
|
||||
-- {{{ big json object
|
||||
request methodOptions "/auto_incrementing_pk" "" `shouldRespondWith` [json|
|
||||
{
|
||||
"pkey":["id"],
|
||||
"columns":{
|
||||
"inserted_at":{
|
||||
"precision":null,
|
||||
"updatable":true,
|
||||
"schema":"1",
|
||||
"name":"inserted_at",
|
||||
"type":"timestamp with time zone",
|
||||
"maxLen":null,
|
||||
"nullable":true,
|
||||
"position":4},
|
||||
"id":{
|
||||
"precision":32,
|
||||
"updatable":true,
|
||||
"schema":"1",
|
||||
"name":"id",
|
||||
"type":"integer",
|
||||
"maxLen":null,
|
||||
"nullable":false,
|
||||
"position":1},
|
||||
"non_nullable_string":{
|
||||
"precision":null,
|
||||
"updatable":true,
|
||||
"schema":"1",
|
||||
"name":"non_nullable_string",
|
||||
"type":"character varying",
|
||||
"maxLen":null,
|
||||
"nullable":false,
|
||||
"position":3},
|
||||
"nullable_string":{
|
||||
"precision":null,
|
||||
"updatable":true,
|
||||
"schema":"1",
|
||||
"name":"nullable_string",
|
||||
"type":"character varying",
|
||||
"maxLen":null,
|
||||
"nullable":true,
|
||||
"position":2}}
|
||||
}
|
||||
|]
|
||||
-- }}}
|
||||
|
||||
describe "GET /view" $
|
||||
context "without range headers" $
|
||||
context "with response under server size limit" $
|
||||
|
||||
@@ -14,7 +14,10 @@ spec = around appWithFixture $ do
|
||||
describe "GET /" $
|
||||
it "lists views in schema" $
|
||||
get "/" `shouldRespondWith`
|
||||
[json| [{"schema":"1","name":"auto_incrementing_pk","insertable":true}] |]
|
||||
[json| [
|
||||
{"schema":"1","name":"auto_incrementing_pk","insertable":true},
|
||||
{"schema":"1","name":"contacts","insertable":true}]
|
||||
|]
|
||||
{matchStatus = 200}
|
||||
|
||||
describe "Table info" $
|
||||
|
||||
Reference in New Issue
Block a user