Be sure to reset db before ALL tests
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
## Serve a RESTful API from any Postgres database
|
## Serve a RESTful API from any Postgres database
|
||||||
|
|
||||||
[](https://travis-ci.org/begriffs/dbapi)
|

|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
machine:
|
machine:
|
||||||
|
pre:
|
||||||
|
- createuser --superuser --no-password dbapi_test
|
||||||
|
- createdb -O dbapi_test -U ubuntu dbapi_test
|
||||||
ghc:
|
ghc:
|
||||||
version: 7.8.3
|
version: 7.8.3
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
name: dbapi
|
name: dbapi
|
||||||
version: 0.2.4.5
|
version: 0.2.4.6
|
||||||
synopsis: The database is your api
|
synopsis: The database is your api
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import SpecHelper
|
|||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
spec :: Spec
|
spec :: Spec
|
||||||
spec = around withApp $
|
spec = before resetDb $ around withApp $
|
||||||
describe "authorization" $ do
|
describe "authorization" $ do
|
||||||
it "hides tables that anonymous does not own" $
|
it "hides tables that anonymous does not own" $
|
||||||
get "/authors_only" `shouldRespondWith` 400 -- TODO: should be 404
|
get "/authors_only" `shouldRespondWith` 400 -- TODO: should be 404
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import Network.HTTP.Types
|
|||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
spec :: Spec
|
spec :: Spec
|
||||||
spec = around withApp $
|
spec = before resetDb $ around withApp $
|
||||||
describe "CORS" $ do
|
describe "CORS" $ do
|
||||||
let preflightHeaders = [
|
let preflightHeaders = [
|
||||||
("Accept", "*/*"),
|
("Accept", "*/*"),
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import Test.Hspec.Wai
|
|||||||
import SpecHelper
|
import SpecHelper
|
||||||
|
|
||||||
spec :: Spec
|
spec :: Spec
|
||||||
spec = around withApp $ do
|
spec = before resetDb $ around withApp $ do
|
||||||
describe "Querying a nonexistent table" $
|
describe "Querying a nonexistent table" $
|
||||||
it "causes a 404" $
|
it "causes a 404" $
|
||||||
get "/faketable" `shouldRespondWith` 404
|
get "/faketable" `shouldRespondWith` 404
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import Network.Wai.Test (SResponse(simpleHeaders,simpleStatus))
|
|||||||
import SpecHelper
|
import SpecHelper
|
||||||
|
|
||||||
spec :: Spec
|
spec :: Spec
|
||||||
spec = around withApp $
|
spec = before resetDb $ around withApp $
|
||||||
describe "GET /items" $ do
|
describe "GET /items" $ do
|
||||||
|
|
||||||
context "without range headers" $
|
context "without range headers" $
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import SpecHelper
|
|||||||
import Network.HTTP.Types
|
import Network.HTTP.Types
|
||||||
|
|
||||||
spec :: Spec
|
spec :: Spec
|
||||||
spec = around withApp $ do
|
spec = before resetDb $ around withApp $ do
|
||||||
describe "GET /" $
|
describe "GET /" $
|
||||||
it "lists views in schema" $ do
|
it "lists views in schema" $ do
|
||||||
_ <- post "/dbapi/users" [json| { "id":"jdoe", "pass": "1234", "role": "dbapi_test_author" } |]
|
_ <- post "/dbapi/users" [json| { "id":"jdoe", "pass": "1234", "role": "dbapi_test_author" } |]
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
{-# LANGUAGE QuasiQuotes #-}
|
{-# LANGUAGE QuasiQuotes, OverloadedStrings #-}
|
||||||
|
|
||||||
module SpecHelper where
|
module SpecHelper where
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user