Make transaction-rollback=true the default for test-suite (#1663)
Change test-suite to use db-tx-rollback-all = true by default
This commit is contained in:
+29
-13
@@ -457,12 +457,24 @@ spec actualPgVersion =
|
||||
`shouldRespondWith` 405
|
||||
|
||||
it "executes the proc exactly once per request" $ do
|
||||
post "/rpc/callcounter" [json| {} |] `shouldRespondWith`
|
||||
[json|1|]
|
||||
{ matchHeaders = [matchContentTypeJson] }
|
||||
post "/rpc/callcounter" [json| {} |] `shouldRespondWith`
|
||||
[json|2|]
|
||||
{ matchHeaders = [matchContentTypeJson] }
|
||||
-- callcounter is persistent even with rollback, because it uses a sequence
|
||||
-- reset counter first to make test repeatable
|
||||
request methodPost "/rpc/reset_sequence"
|
||||
[("Prefer", "tx=commit")]
|
||||
[json|{"name": "callcounter_count", "value": 1}|]
|
||||
`shouldRespondWith`
|
||||
[json|""|]
|
||||
|
||||
-- now the test
|
||||
post "/rpc/callcounter"
|
||||
[json|{}|]
|
||||
`shouldRespondWith`
|
||||
[json|1|]
|
||||
|
||||
post "/rpc/callcounter"
|
||||
[json|{}|]
|
||||
`shouldRespondWith`
|
||||
[json|2|]
|
||||
|
||||
context "a proc that receives no parameters" $ do
|
||||
it "interprets empty string as empty json object on a post request" $
|
||||
@@ -891,11 +903,13 @@ spec actualPgVersion =
|
||||
"Set-Cookie" <:> "id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT; Secure; HttpOnly"]}
|
||||
|
||||
it "can override the Location header on a trigger" $
|
||||
request methodPost "/stuff" [] [json|[{"id": 1, "name": "stuff 1"}]|]
|
||||
`shouldRespondWith` ""
|
||||
{ matchStatus = 201
|
||||
, matchHeaders = ["Location" <:> "/stuff?id=eq.1&overriden=true"]
|
||||
}
|
||||
post "/stuff"
|
||||
[json|[{"id": 2, "name": "stuff 2"}]|]
|
||||
`shouldRespondWith`
|
||||
""
|
||||
{ matchStatus = 201
|
||||
, matchHeaders = ["Location" <:> "/stuff?id=eq.2&overriden=true"]
|
||||
}
|
||||
|
||||
-- On https://github.com/PostgREST/postgrest/issues/1427#issuecomment-595907535
|
||||
-- it was reported that blank headers ` : ` where added and that cause proxies to fail the requests.
|
||||
@@ -935,8 +949,10 @@ spec actualPgVersion =
|
||||
}
|
||||
|
||||
it "can override the status through trigger" $
|
||||
request methodPatch "/stuff?id=eq.1" [] [json|[{"name": "updated stuff 1"}]|]
|
||||
`shouldRespondWith` 205
|
||||
patch "/stuff?id=eq.1"
|
||||
[json|[{"name": "updated stuff 1"}]|]
|
||||
`shouldRespondWith`
|
||||
205
|
||||
|
||||
it "fails when setting invalid status guc" $
|
||||
get "/rpc/send_bad_status"
|
||||
|
||||
Reference in New Issue
Block a user