-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | QuickCheck entire APIs -- -- This packages provides QuickCheck properties that are tested across an -- entire API. @package servant-quickcheck @version 0.0.4 module Servant.QuickCheck.Internal.HasGenRequest -- | This function returns a QuickCheck `Gen a` when passed a servant API -- value, typically a `Proxy API`. The generator returned is a function -- that accepts a BaseUrl and returns a Request, which can -- then be used to issue network requests. This Gen type makes it -- easier to compare distinct APIs across different BaseUrls. runGenRequest :: HasGenRequest a => Proxy a -> Gen (BaseUrl -> Request) -- | This is the core Servant-Quickcheck generator, which, when given a -- `Proxy API` will return a pair of Int and `Gen a`, where -- a is a function from BaseUrl to a Request. The -- Int is a weight for the QuickCheck frequency function -- which ensures a random distribution across all endpoints in an API. class HasGenRequest a genRequest :: HasGenRequest a => Proxy a -> (Int, Gen (BaseUrl -> Request)) instance (Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest a, Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest b) => Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest (a Servant.API.Alternative.:<|> b) instance forall k (path :: GHC.Types.Symbol) (b :: k). (GHC.TypeLits.KnownSymbol path, Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest b) => Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest (path Servant.API.Sub.:> b) instance Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest Servant.API.Empty.EmptyAPI instance forall k (api :: k) (d :: GHC.Types.Symbol). Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest api => Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest (Servant.API.Description.Summary d Servant.API.Sub.:> api) instance forall k (api :: k) (d :: GHC.Types.Symbol). Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest api => Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest (Servant.API.Description.Description d Servant.API.Sub.:> api) instance forall k c (b :: k) (x :: GHC.Types.Symbol). (Test.QuickCheck.Arbitrary.Arbitrary c, Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest b, Web.Internal.HttpApiData.ToHttpApiData c) => Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest (Servant.API.Capture.Capture x c Servant.API.Sub.:> b) instance forall k c (b :: k) (x :: GHC.Types.Symbol). (Test.QuickCheck.Arbitrary.Arbitrary c, Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest b, Web.Internal.HttpApiData.ToHttpApiData c) => Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest (Servant.API.Capture.CaptureAll x c Servant.API.Sub.:> b) instance forall k c (h :: GHC.Types.Symbol) (b :: k). (Test.QuickCheck.Arbitrary.Arbitrary c, GHC.TypeLits.KnownSymbol h, Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest b, Web.Internal.HttpApiData.ToHttpApiData c) => Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest (Servant.API.Header.Header h c Servant.API.Sub.:> b) instance forall k (x :: [GHC.Types.*]) c (b :: k). (Servant.API.ContentTypes.AllMimeRender x c, Test.QuickCheck.Arbitrary.Arbitrary c, Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest b) => Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest (Servant.API.ReqBody.ReqBody x c Servant.API.Sub.:> b) instance forall k (x :: GHC.Types.Symbol) c (b :: k). (GHC.TypeLits.KnownSymbol x, Test.QuickCheck.Arbitrary.Arbitrary c, Web.Internal.HttpApiData.ToHttpApiData c, Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest b) => Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest (Servant.API.QueryParam.QueryParam x c Servant.API.Sub.:> b) instance forall k (x :: GHC.Types.Symbol) c (b :: k). (GHC.TypeLits.KnownSymbol x, Test.QuickCheck.Arbitrary.Arbitrary c, Web.Internal.HttpApiData.ToHttpApiData c, Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest b) => Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest (Servant.API.QueryParam.QueryParams x c Servant.API.Sub.:> b) instance forall k (x :: GHC.Types.Symbol) (b :: k). (GHC.TypeLits.KnownSymbol x, Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest b) => Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest (Servant.API.QueryParam.QueryFlag x Servant.API.Sub.:> b) instance forall k k1 (method :: k1) (status :: GHC.Types.Nat) (cts :: [GHC.Types.*]) (a :: k). Servant.API.Verbs.ReflectMethod method => Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest (Servant.API.Verbs.Verb method status cts a) instance forall k (a :: k). Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest a => Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest (Servant.API.RemoteHost.RemoteHost Servant.API.Sub.:> a) instance forall k (a :: k). Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest a => Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest (Servant.API.IsSecure.IsSecure Servant.API.Sub.:> a) instance forall k (a :: k). Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest a => Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest (Network.HTTP.Types.Version.HttpVersion Servant.API.Sub.:> a) instance forall k (a :: k). Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest a => Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest (Data.Vault.Lazy.Vault Servant.API.Sub.:> a) instance Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest a => Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest (Servant.API.WithNamedContext.WithNamedContext x y a) instance forall k (a :: k) (x :: GHC.Types.Symbol) y. Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest a => Servant.QuickCheck.Internal.HasGenRequest.HasGenRequest (Servant.API.BasicAuth.BasicAuth x y Servant.API.Sub.:> a) module Servant.QuickCheck.Internal.ErrorTypes data PredicateFailure PredicateFailure :: Text -> (Maybe Request) -> (Response ByteString) -> PredicateFailure data ServerEqualityFailure ServerEqualityFailure :: Request -> (Response ByteString) -> (Response ByteString) -> ServerEqualityFailure prettyHeaders :: [Header] -> Doc prettyReq :: Request -> Doc prettyResp :: Response ByteString -> Doc prettyServerEqualityFailure :: ServerEqualityFailure -> Doc prettyPredicateFailure :: PredicateFailure -> Doc instance GHC.Generics.Generic Servant.QuickCheck.Internal.ErrorTypes.ServerEqualityFailure instance GHC.Generics.Generic Servant.QuickCheck.Internal.ErrorTypes.PredicateFailure instance GHC.Exception.Exception Servant.QuickCheck.Internal.ErrorTypes.ServerEqualityFailure instance GHC.Show.Show Servant.QuickCheck.Internal.ErrorTypes.PredicateFailure instance GHC.Show.Show Servant.QuickCheck.Internal.ErrorTypes.ServerEqualityFailure instance GHC.Exception.Exception Servant.QuickCheck.Internal.ErrorTypes.PredicateFailure module Servant.QuickCheck.Internal.Predicates -- | -- -- 500 Internal Server Error should be avoided - it may -- represent some issue with the application code, and it moreover gives -- the client little indication of how to proceed or what went wrong. -- -- This function checks that the response code is not 500. -- -- Since 0.0.0.0 not500 :: ResponsePredicate -- | -- -- This function checks that the response from the server does not take -- longer than the specified number of nanoseconds. -- -- Since 0.0.2.1 notLongerThan :: Integer -> RequestPredicate -- | -- -- Returning anything other than an object when returning JSON is -- considered bad practice, as: -- --
    --
  1. it is hard to modify the returned value while maintaining -- backwards compatibility
  2. --
  3. many older tools do not support top-level arrays
  4. --
  5. whether top-level numbers, booleans, or strings are valid JSON -- depends on what RFC you're going by
  6. --
  7. there are security issues with top-level arrays
  8. --
-- -- This function checks that any application/json responses only -- return JSON objects (and not arrays, strings, numbers, or booleans) at -- the top level. -- -- References: -- -- -- -- Since 0.0.0.0 onlyJsonObjects :: ResponsePredicate -- | Optional -- -- When creating a new resource, it is good practice to provide a -- Location header with a link to the created resource. -- -- This function checks that every 201 Created response contains -- a Location header, and that the link in it responds with a -- 2XX response code to GET requests. -- -- This is considered optional because other means of linking to the -- resource (e.g. via the response body) are also acceptable; linking to -- the resource in some way is considered best practice. -- -- References: -- -- -- -- Since 0.0.0.0 createContainsValidLocation :: RequestPredicate -- | -- -- The Last-Modified header represents the time a resource was -- last modified. It is used to drive caching and conditional requests. -- -- When using this mechanism, the server adds the Last-Modified -- header to responses. Clients may then make requests with the -- If-Modified-Since header to conditionally request resources. -- If the resource has not changed since that date, the server responds -- with a status code of 304 (Not Modified) without a response -- body. -- -- The Last-Modified header can also be used in conjunction with -- the If-Unmodified-Since header to drive optimistic -- concurrency. -- -- The Last-Modified date must be in RFC 822 format. -- -- References: -- -- -- -- Since 0.0.2.1 getsHaveLastModifiedHeader :: RequestPredicate -- | -- -- When an HTTP request has a method that is not allowed, a 405 response -- should be returned. Additionally, it is good practice to return an -- Allow header with the list of allowed methods. -- -- This function checks that every 405 Method Not Allowed -- response contains an Allow header with a list of standard -- HTTP methods. -- -- Note that servant itself does not currently set the -- Allow headers. -- -- References: -- -- -- -- Since 0.0.0.0 notAllowedContainsAllowHeader :: RequestPredicate -- | -- -- When a request contains an Accept header, the server must -- either return content in one of the requested representations, or -- respond with 406 Not Acceptable. -- -- This function checks that every *successful* response has a -- Content-Type header that matches the Accept header. -- It does *not* check that the server matches the quality descriptions -- of the Accept header correctly. -- -- References: -- -- -- -- Since 0.0.0.0 honoursAcceptHeader :: RequestPredicate -- | -- -- Whether or not a representation should be cached, it is good practice -- to have a Cache-Control header for GET requests. If -- the representation should not be cached, used Cache-Control: -- no-cache. -- -- This function checks that GET responses have -- Cache-Control header. It does NOT currently check that the -- header is valid. -- -- References: -- -- -- -- Since 0.0.0.0 getsHaveCacheControlHeader :: RequestPredicate -- | -- -- Like getsHaveCacheControlHeader, but for HEAD -- requests. -- -- Since 0.0.0.0 headsHaveCacheControlHeader :: RequestPredicate -- | -- -- Any 401 Unauthorized response must include a -- WWW-Authenticate header. -- -- This function checks that, if a response has status code 401, it -- contains a WWW-Authenticate header. -- -- References: -- -- -- -- Since 0.0.0.0 unauthorizedContainsWWWAuthenticate :: ResponsePredicate -- | -- -- This function checks that HTML documents (those with `Content-Type: -- text/html...`) include a DOCTYPE declaration at the top. We do not -- enforce capital case for the string DOCTYPE. -- -- References: -- -- htmlIncludesDoctype :: ResponsePredicate -- | A predicate that depends only on the response. -- -- Since 0.0.0.0 newtype ResponsePredicate ResponsePredicate :: (Response ByteString -> IO ()) -> ResponsePredicate [getResponsePredicate] :: ResponsePredicate -> Response ByteString -> IO () -- | A predicate that depends on both the request and the response. -- -- Since 0.0.0.0 newtype RequestPredicate RequestPredicate :: (Request -> Manager -> IO [Response ByteString]) -> RequestPredicate [getRequestPredicate] :: RequestPredicate -> Request -> Manager -> IO [Response ByteString] -- | A set of predicates. Construct one with mempty and -- <%>. data Predicates Predicates :: RequestPredicate -> ResponsePredicate -> Predicates [requestPredicates] :: Predicates -> RequestPredicate [responsePredicates] :: Predicates -> ResponsePredicate class JoinPreds a joinPreds :: JoinPreds a => a -> Predicates -> Predicates -- | Adds a new predicate (either ResponsePredicate or -- RequestPredicate) to the existing predicates. -- --
--   not500 <%> onlyJsonObjects <%> empty
--   
-- -- Since 0.0.0.0 (<%>) :: JoinPreds a => a -> Predicates -> Predicates infixr 6 <%> finishPredicates :: Predicates -> Request -> Manager -> IO (Maybe PredicateFailure) hasValidHeader :: ByteString -> (ByteString -> Bool) -> Response b -> Bool isRFC822Date :: ByteString -> Bool status2XX :: Monad m => Maybe Request -> Response ByteString -> Text -> m () instance GHC.Generics.Generic Servant.QuickCheck.Internal.Predicates.Predicates instance GHC.Generics.Generic Servant.QuickCheck.Internal.Predicates.RequestPredicate instance GHC.Generics.Generic Servant.QuickCheck.Internal.Predicates.ResponsePredicate instance GHC.Base.Monoid Servant.QuickCheck.Internal.Predicates.ResponsePredicate instance GHC.Base.Monoid Servant.QuickCheck.Internal.Predicates.RequestPredicate instance GHC.Base.Monoid Servant.QuickCheck.Internal.Predicates.Predicates instance Servant.QuickCheck.Internal.Predicates.JoinPreds Servant.QuickCheck.Internal.Predicates.RequestPredicate instance Servant.QuickCheck.Internal.Predicates.JoinPreds Servant.QuickCheck.Internal.Predicates.ResponsePredicate module Servant.QuickCheck.Internal.Equality newtype ResponseEquality b ResponseEquality :: (Response b -> Response b -> Bool) -> ResponseEquality b [getResponseEquality] :: ResponseEquality b -> Response b -> Response b -> Bool -- | Use Eq instance for Response -- -- Since 0.0.0.0 allEquality :: Eq b => ResponseEquality b -- | ByteString Eq instance over the response body. -- -- Since 0.0.0.0 bodyEquality :: Eq b => ResponseEquality b -- | Equality as Value. This means that if two bodies are equal as -- JSON (e.g., insignificant whitespace difference) they are considered -- equal. -- -- Since 0.0.3.0 jsonEquality :: (JsonEq b) => ResponseEquality b class JsonEq a where jsonEq first second = compareDecodedResponses (decode' first) (decode' second) decode' :: JsonEq a => a -> Maybe Value jsonEq :: JsonEq a => a -> a -> Bool compareDecodedResponses :: Maybe Value -> Maybe Value -> Bool instance GHC.Base.Monoid (Servant.QuickCheck.Internal.Equality.ResponseEquality b) instance Servant.QuickCheck.Internal.Equality.JsonEq Data.ByteString.Lazy.Internal.ByteString instance Servant.QuickCheck.Internal.Equality.JsonEq Data.ByteString.Internal.ByteString module Servant.QuickCheck.Internal.QuickCheck -- | Start a servant application on an open port, run the provided -- function, then stop the application. -- -- Since 0.0.0.0 withServantServer :: HasServer a '[] => Proxy a -> IO (Server a) -> (BaseUrl -> IO r) -> IO r -- | Like withServantServer, but allows passing in a Context -- to the application. -- -- Since 0.0.0.0 withServantServerAndContext :: HasServer a ctx => Proxy a -> Context ctx -> IO (Server a) -> (BaseUrl -> IO r) -> IO r -- | Check that the two servers running under the provided -- BaseUrls behave identically by randomly generating arguments -- (captures, query params, request bodies, headers, etc.) expected by -- the server. If, given the same request, the response is not the same -- (according to the definition of == for the return datatype), -- the Expectation fails, printing the counterexample. -- -- The Int argument specifies maximum number of test cases to -- generate and run. -- -- Evidently, if the behaviour of the server is expected to be -- non-deterministic, this function may produce spurious failures -- -- Note that only valid requests are generated and tested. As an example -- of why this matters, let's say your API specifies that a particular -- endpoint can only generate JSON. serversEqual will -- then not generate any requests with an Accept header _other_ -- than application/json. It may therefore fail to notice that -- one application, when the request has Accept: text/html, -- returns a 406 Not Acceptable HTTP response, and another -- returns a 200 Success, but with application/json as -- the content-type. -- -- The fact that only valid requests are tested also means that no -- endpoints not listed in the API type are tested. -- -- Since 0.0.0.0 serversEqual :: HasGenRequest a => Proxy a -> BaseUrl -> BaseUrl -> Args -> ResponseEquality ByteString -> Expectation -- | Check that a server satisfies the set of properties specified. -- -- Note that, rather than having separate tests for each property you'd -- like to test, you should generally prefer to combine all properties -- into a single test. This enables a more parsimonious generation of -- requests and responses with the same testing depth. -- -- Example usage: -- --
--   goodAPISpec = describe "my server" $ do
--   
--     it "follows best practices" $ do
--       withServantServer api server $ \burl ->
--         serverSatisfies api burl stdArgs (not500
--                                       <%> onlyJsonObjects
--                                       <%> notAllowedContainsAllowHeader
--                                       <%> mempty)
--   
-- -- Since 0.0.0.0 serverSatisfies :: (HasGenRequest a) => Proxy a -> BaseUrl -> Args -> Predicates -> Expectation serverDoesntSatisfy :: (HasGenRequest a) => Proxy a -> BaseUrl -> Args -> Predicates -> Expectation noCheckStatus :: Request -> Request defManager :: Manager module Servant.QuickCheck.Internal -- | Servant.QuickCheck provides utilities related to using -- QuickCheck over an API. Rather than specifying properties that -- individual handlers must satisfy, you can state properties that ought -- to hold true of the entire API. -- -- While the API must be described with servant types, the -- server being tested itself need not be implemented with -- servant-server (or indeed, written in Haskell). -- -- The documentation of the Useful predicates sections is meant to -- serve as a set of helpful pointers for learning more about best -- practices concerning REST APIs. module Servant.QuickCheck -- | Check that a server satisfies the set of properties specified. -- -- Note that, rather than having separate tests for each property you'd -- like to test, you should generally prefer to combine all properties -- into a single test. This enables a more parsimonious generation of -- requests and responses with the same testing depth. -- -- Example usage: -- --
--   goodAPISpec = describe "my server" $ do
--   
--     it "follows best practices" $ do
--       withServantServer api server $ \burl ->
--         serverSatisfies api burl stdArgs (not500
--                                       <%> onlyJsonObjects
--                                       <%> notAllowedContainsAllowHeader
--                                       <%> mempty)
--   
-- -- Since 0.0.0.0 serverSatisfies :: (HasGenRequest a) => Proxy a -> BaseUrl -> Args -> Predicates -> Expectation -- | -- -- 500 Internal Server Error should be avoided - it may -- represent some issue with the application code, and it moreover gives -- the client little indication of how to proceed or what went wrong. -- -- This function checks that the response code is not 500. -- -- Since 0.0.0.0 not500 :: ResponsePredicate -- | -- -- This function checks that the response from the server does not take -- longer than the specified number of nanoseconds. -- -- Since 0.0.2.1 notLongerThan :: Integer -> RequestPredicate -- | -- -- Returning anything other than an object when returning JSON is -- considered bad practice, as: -- --
    --
  1. it is hard to modify the returned value while maintaining -- backwards compatibility
  2. --
  3. many older tools do not support top-level arrays
  4. --
  5. whether top-level numbers, booleans, or strings are valid JSON -- depends on what RFC you're going by
  6. --
  7. there are security issues with top-level arrays
  8. --
-- -- This function checks that any application/json responses only -- return JSON objects (and not arrays, strings, numbers, or booleans) at -- the top level. -- -- References: -- -- -- -- Since 0.0.0.0 onlyJsonObjects :: ResponsePredicate -- | -- -- When an HTTP request has a method that is not allowed, a 405 response -- should be returned. Additionally, it is good practice to return an -- Allow header with the list of allowed methods. -- -- This function checks that every 405 Method Not Allowed -- response contains an Allow header with a list of standard -- HTTP methods. -- -- Note that servant itself does not currently set the -- Allow headers. -- -- References: -- -- -- -- Since 0.0.0.0 notAllowedContainsAllowHeader :: RequestPredicate -- | -- -- Any 401 Unauthorized response must include a -- WWW-Authenticate header. -- -- This function checks that, if a response has status code 401, it -- contains a WWW-Authenticate header. -- -- References: -- -- -- -- Since 0.0.0.0 unauthorizedContainsWWWAuthenticate :: ResponsePredicate -- | -- -- Whether or not a representation should be cached, it is good practice -- to have a Cache-Control header for GET requests. If -- the representation should not be cached, used Cache-Control: -- no-cache. -- -- This function checks that GET responses have -- Cache-Control header. It does NOT currently check that the -- header is valid. -- -- References: -- -- -- -- Since 0.0.0.0 getsHaveCacheControlHeader :: RequestPredicate -- | -- -- Like getsHaveCacheControlHeader, but for HEAD -- requests. -- -- Since 0.0.0.0 headsHaveCacheControlHeader :: RequestPredicate -- | Optional -- -- When creating a new resource, it is good practice to provide a -- Location header with a link to the created resource. -- -- This function checks that every 201 Created response contains -- a Location header, and that the link in it responds with a -- 2XX response code to GET requests. -- -- This is considered optional because other means of linking to the -- resource (e.g. via the response body) are also acceptable; linking to -- the resource in some way is considered best practice. -- -- References: -- -- -- -- Since 0.0.0.0 createContainsValidLocation :: RequestPredicate -- | -- -- This function checks that HTML documents (those with `Content-Type: -- text/html...`) include a DOCTYPE declaration at the top. We do not -- enforce capital case for the string DOCTYPE. -- -- References: -- -- htmlIncludesDoctype :: ResponsePredicate -- | Adds a new predicate (either ResponsePredicate or -- RequestPredicate) to the existing predicates. -- --
--   not500 <%> onlyJsonObjects <%> empty
--   
-- -- Since 0.0.0.0 (<%>) :: JoinPreds a => a -> Predicates -> Predicates infixr 6 <%> -- | A set of predicates. Construct one with mempty and -- <%>. data Predicates -- | A predicate that depends only on the response. -- -- Since 0.0.0.0 newtype ResponsePredicate ResponsePredicate :: (Response ByteString -> IO ()) -> ResponsePredicate [getResponsePredicate] :: ResponsePredicate -> Response ByteString -> IO () -- | A predicate that depends on both the request and the response. -- -- Since 0.0.0.0 newtype RequestPredicate RequestPredicate :: (Request -> Manager -> IO [Response ByteString]) -> RequestPredicate [getRequestPredicate] :: RequestPredicate -> Request -> Manager -> IO [Response ByteString] -- | Check that the two servers running under the provided -- BaseUrls behave identically by randomly generating arguments -- (captures, query params, request bodies, headers, etc.) expected by -- the server. If, given the same request, the response is not the same -- (according to the definition of == for the return datatype), -- the Expectation fails, printing the counterexample. -- -- The Int argument specifies maximum number of test cases to -- generate and run. -- -- Evidently, if the behaviour of the server is expected to be -- non-deterministic, this function may produce spurious failures -- -- Note that only valid requests are generated and tested. As an example -- of why this matters, let's say your API specifies that a particular -- endpoint can only generate JSON. serversEqual will -- then not generate any requests with an Accept header _other_ -- than application/json. It may therefore fail to notice that -- one application, when the request has Accept: text/html, -- returns a 406 Not Acceptable HTTP response, and another -- returns a 200 Success, but with application/json as -- the content-type. -- -- The fact that only valid requests are tested also means that no -- endpoints not listed in the API type are tested. -- -- Since 0.0.0.0 serversEqual :: HasGenRequest a => Proxy a -> BaseUrl -> BaseUrl -> Args -> ResponseEquality ByteString -> Expectation -- | ByteString Eq instance over the response body. -- -- Since 0.0.0.0 bodyEquality :: Eq b => ResponseEquality b -- | Equality as Value. This means that if two bodies are equal as -- JSON (e.g., insignificant whitespace difference) they are considered -- equal. -- -- Since 0.0.3.0 jsonEquality :: (JsonEq b) => ResponseEquality b -- | Use Eq instance for Response -- -- Since 0.0.0.0 allEquality :: Eq b => ResponseEquality b newtype ResponseEquality b ResponseEquality :: (Response b -> Response b -> Bool) -> ResponseEquality b [getResponseEquality] :: ResponseEquality b -> Response b -> Response b -> Bool -- | Start a servant application on an open port, run the provided -- function, then stop the application. -- -- Since 0.0.0.0 withServantServer :: HasServer a '[] => Proxy a -> IO (Server a) -> (BaseUrl -> IO r) -> IO r -- | Like withServantServer, but allows passing in a Context -- to the application. -- -- Since 0.0.0.0 withServantServerAndContext :: HasServer a ctx => Proxy a -> Context ctx -> IO (Server a) -> (BaseUrl -> IO r) -> IO r -- | QuickCheck Args with 1000 rather than 100 test cases. -- -- Since 0.0.0.0 defaultArgs :: Args -- | Simple data type to represent the target of HTTP requests for -- servant's automatically-generated clients. data BaseUrl :: * BaseUrl :: Scheme -> String -> Int -> String -> BaseUrl -- | URI scheme to use [baseUrlScheme] :: BaseUrl -> Scheme -- | host (eg "haskell.org") [baseUrlHost] :: BaseUrl -> String -- | port (eg 80) [baseUrlPort] :: BaseUrl -> Int -- | path (eg "ab/c") [baseUrlPath] :: BaseUrl -> String -- | URI scheme to use data Scheme :: * -- | http:// Http :: Scheme -- | https:// Https :: Scheme -- | Args specifies arguments to the QuickCheck driver data Args :: * Args :: Maybe (QCGen, Int) -> Int -> Int -> Int -> Bool -> Int -> Args -- | Should we replay a previous test? Note: saving a seed from one version -- of QuickCheck and replaying it in another is not supported. If you -- want to store a test case permanently you should save the test case -- itself. [replay] :: Args -> Maybe (QCGen, Int) -- | Maximum number of successful tests before succeeding. Testing stops at -- the first failure. If all tests are passing and you want to run more -- tests, increase this number. [maxSuccess] :: Args -> Int -- | Maximum number of discarded tests per successful test before giving up [maxDiscardRatio] :: Args -> Int -- | Size to use for the biggest test cases [maxSize] :: Args -> Int -- | Whether to print anything [chatty] :: Args -> Bool -- | Maximum number of shrinks to before giving up. Setting this to zero -- turns shrinking off. [maxShrinks] :: Args -> Int -- | A concrete, poly-kinded proxy type data Proxy k (t :: k) :: forall k. k -> * Proxy :: Proxy k