test: move prepared statements config related tests to spec tests
Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
module Feature.Query.PreparedStatementsSpec where
|
||||
|
||||
import Network.HTTP.Types
|
||||
import Test.Hspec hiding (pendingWith)
|
||||
import Test.Hspec.Wai
|
||||
import Text.Heredoc
|
||||
|
||||
import PostgREST.Config (AppConfig (..))
|
||||
|
||||
import Protolude hiding (get)
|
||||
import SpecHelper
|
||||
|
||||
spec :: SpecWithConfig
|
||||
spec withConfig = do
|
||||
withConfig baseCfg { configDbPreparedStatements = True } $
|
||||
it "should use prepared statements when the setting is enabled" $
|
||||
request methodPost "/rpc/uses_prepared_statements"
|
||||
[] ""
|
||||
`shouldRespondWith`
|
||||
[str|true|]
|
||||
{ matchStatus = 200 }
|
||||
|
||||
withConfig baseCfg { configDbPreparedStatements = False } $
|
||||
it "should not use any prepared statements when the setting is disabled" $ do
|
||||
request methodGet "/never_prepared"
|
||||
[] ""
|
||||
`shouldRespondWith` 200
|
||||
|
||||
request methodPost "/rpc/never_uses_prepared_statements"
|
||||
[] ""
|
||||
`shouldRespondWith`
|
||||
[str|true|]
|
||||
{ matchStatus = 200 }
|
||||
Reference in New Issue
Block a user