Test OPTIONS request for /table
This commit is contained in:
@@ -7,6 +7,7 @@ import Test.Hspec.Wai.JSON
|
|||||||
|
|
||||||
import SpecHelper
|
import SpecHelper
|
||||||
|
|
||||||
|
import Network.HTTP.Types
|
||||||
import Dbapi (app)
|
import Dbapi (app)
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
@@ -18,7 +19,54 @@ spec = with (prepareAppDb "schema" $ app cfg) $ do
|
|||||||
it "responds with 200" $ do
|
it "responds with 200" $ do
|
||||||
get "/" `shouldRespondWith` 200
|
get "/" `shouldRespondWith` 200
|
||||||
|
|
||||||
it "responds with 'hello'" $ do
|
it "lists views in schema" $ do
|
||||||
get "/" `shouldRespondWith` [json|
|
get "/" `shouldRespondWith` [json|
|
||||||
[{"schema":"1","name":"auto_incrementing_pk","insertable":true}]
|
[{"schema":"1","name":"auto_incrementing_pk","insertable":true}]
|
||||||
|]
|
|]
|
||||||
|
|
||||||
|
describe "Table info" $ do
|
||||||
|
it "available with OPTIONS verb" $ do
|
||||||
|
-- {{{ 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}}
|
||||||
|
}
|
||||||
|
|]
|
||||||
|
-- }}}
|
||||||
|
|||||||
Reference in New Issue
Block a user