Fix json test versioning for postgresql 10.9 bugfix (#1340)

This removes the test for buggy behaviour, it seems not useful
anymore.
This commit is contained in:
Robert
2019-07-05 12:54:44 -05:00
committed by Steve Chávez
parent 25dedd1098
commit 64dc6ab9ac
2 changed files with 11 additions and 16 deletions
+6
View File
@@ -426,6 +426,12 @@ pgVersion96 = PgVersion 90600 "9.6"
pgVersion100 :: PgVersion
pgVersion100 = PgVersion 100000 "10"
pgVersion109 :: PgVersion
pgVersion109 = PgVersion 100009 "10.9"
pgVersion110 :: PgVersion
pgVersion110 = PgVersion 110000 "11.0"
pgVersion112 :: PgVersion
pgVersion112 = PgVersion 110002 "11.2"
+5 -16
View File
@@ -11,8 +11,8 @@ import Test.Hspec.Wai
import Test.Hspec.Wai.JSON
import Text.Heredoc
import PostgREST.Types (PgVersion, pgVersion100, pgVersion114,
pgVersion95)
import PostgREST.Types (PgVersion, pgVersion100, pgVersion109,
pgVersion110, pgVersion114, pgVersion95)
import Protolude hiding (get)
import SpecHelper
@@ -264,26 +264,15 @@ spec actualPgVersion =
[json|"object"|]
{ matchHeaders = [matchContentTypeJson] }
when (actualPgVersion >= pgVersion114) $
it "parses quoted JSON arguments as JSON string (Postgres >= 11.4)" $
when ((actualPgVersion >= pgVersion109 && actualPgVersion < pgVersion110)
|| actualPgVersion >= pgVersion114) $
it "parses quoted JSON arguments as JSON string (from Postgres 10.9, 11.4)" $
post "/rpc/json_argument"
[json| { "arg": "{ \"key\": 3 }" } |]
`shouldRespondWith`
[json|"string"|]
{ matchHeaders = [matchContentTypeJson] }
when (actualPgVersion >= pgVersion100 && actualPgVersion < pgVersion114) $
it "fails to parse quoted JSON arguments (Postgres >= 10, < 11.4)" $
-- Confirming buggy Postgres behavior:
-- https://www.postgresql.org/message-id/D6921B37-BD8E-4664-8D5F-DB3525765DCD%40vllmrt.net
post "/rpc/json_argument"
[json| { "arg": "{ \"key\": 3 }" } |]
`shouldRespondWith`
[json|{"hint":null,"details":"Token \"key\" is invalid.","code":"22P02","message":"invalid input syntax for type json"}|]
{ matchStatus = 400
, matchHeaders = [matchContentTypeJson]
}
context "improper input" $ do
it "rejects unknown content type even if payload is good" $ do
request methodPost "/rpc/sayhello"