hedgehog-servant-0.0.0.1: Hedgehog property testing for Servant APIs

Safe HaskellNone
LanguageHaskell2010

Hedgehog.Servant

Synopsis

Documentation

data GList (a :: [*]) where Source #

Data structure used in order to specify generators for API

Example usage:

type Api = "cats" :> ReqBody '[JSON] Cat :> Post '[JSON] ()

catGen :: Gen Cat
catGen = _

genApi :: Gen (BaseUrl -> Request)
genApi = genRequest (Proxy @Api) (catGen :*: GNil)

Constructors

GNil :: GList '[] 
(:*:) :: Gen x -> GList xs -> GList (Gen x ': xs) infixr 6 

class HasGen (g :: *) (gens :: [*]) where Source #

Simple getter from a GList of possible generators

Methods

getGen :: GList gens -> Gen g Source #

Instances
HasGen h rest => HasGen h (first ': rest) Source # 
Instance details

Defined in Hedgehog.Servant

Methods

getGen :: GList (first ': rest) -> Gen h Source #

HasGen h (Gen h ': rest) Source # 
Instance details

Defined in Hedgehog.Servant

Methods

getGen :: GList (Gen h ': rest) -> Gen h Source #

class GenRequest (api :: *) (gens :: [*]) where Source #

Type class used to generate requests from a 'GList gens' for API api

Methods

genRequest :: Proxy api -> GList gens -> Gen (BaseUrl -> Request) Source #

Instances
(GenRequest a reqs, GenRequest b reqs) => GenRequest (a :<|> b) reqs Source #

Instance for composite APIs

Instance details

Defined in Hedgehog.Servant

Methods

genRequest :: Proxy (a :<|> b) -> GList reqs -> Gen (BaseUrl -> Request) Source #

GenRequest api gens => GenRequest (HttpVersion :> api) gens Source #

This instance doees not do anything right now

Note: in order to use features provided by this type in the API, you'll need to manually adjust the generated request.

Instance details

Defined in Hedgehog.Servant

Methods

genRequest :: Proxy (HttpVersion :> api) -> GList gens -> Gen (BaseUrl -> Request) Source #

GenRequest api gens => GenRequest (BasicAuth x y :> api) gens Source #

This instance doees not do anything right now

Note: in order to use features provided by this type in the API, you'll need to manually adjust the generated request.

Instance details

Defined in Hedgehog.Servant

Methods

genRequest :: Proxy (BasicAuth x y :> api) -> GList gens -> Gen (BaseUrl -> Request) Source #

(ToHttpApiData a, HasGen a gens, GenRequest api gens) => GenRequest (Capture' modifiers sym a :> api) gens Source #

Instance for path capture

Instance details

Defined in Hedgehog.Servant

Methods

genRequest :: Proxy (Capture' modifiers sym a :> api) -> GList gens -> Gen (BaseUrl -> Request) Source #

(ToHttpApiData a, HasGen a gens, GenRequest api gens) => GenRequest (CaptureAll sym a :> api) gens Source #

Instance for capture rest of path, e.g:

type Api = "cats" :> CaptureAll "rest" Text :> Get '[JSON] [Cat]

For simplicity this will generate a number of paths from 0 to 10 linearly

Instance details

Defined in Hedgehog.Servant

Methods

genRequest :: Proxy (CaptureAll sym a :> api) -> GList gens -> Gen (BaseUrl -> Request) Source #

GenRequest api reqs => GenRequest (Description d :> api) reqs Source #

Instance for description

Instance details

Defined in Hedgehog.Servant

Methods

genRequest :: Proxy (Description d :> api) -> GList reqs -> Gen (BaseUrl -> Request) Source #

GenRequest api reqs => GenRequest (Summary s :> api) reqs Source #

Instance for summary

Instance details

Defined in Hedgehog.Servant

Methods

genRequest :: Proxy (Summary s :> api) -> GList reqs -> Gen (BaseUrl -> Request) Source #

(HasGen header gens, KnownSymbol headerName, ToHttpApiData header, GenRequest api gens) => GenRequest (Header' mods headerName header :> api) gens Source #

Instance for headers

Note: this instance currently makes all headers mandatory

Instance details

Defined in Hedgehog.Servant

Methods

genRequest :: Proxy (Header' mods headerName header :> api) -> GList gens -> Gen (BaseUrl -> Request) Source #

GenRequest api gens => GenRequest (IsSecure :> api) gens Source #

This instance doees not do anything right now

Note: in order to use features provided by this type in the API, you'll need to manually adjust the generated request.

Instance details

Defined in Hedgehog.Servant

Methods

genRequest :: Proxy (IsSecure :> api) -> GList gens -> Gen (BaseUrl -> Request) Source #

(KnownSymbol name, GenRequest api gens) => GenRequest (QueryFlag name :> api) gens Source #

Instance for setting query flag

Note: this instance currently makes all query flags mandatory

Instance details

Defined in Hedgehog.Servant

Methods

genRequest :: Proxy (QueryFlag name :> api) -> GList gens -> Gen (BaseUrl -> Request) Source #

(KnownSymbol paramName, ToHttpApiData param, HasGen param gens, GenRequest api gens) => GenRequest (QueryParam' mods paramName param :> api) gens Source #

Instance for setting query parameters

Note: this instance currently makes all query params mandatory

Instance details

Defined in Hedgehog.Servant

Methods

genRequest :: Proxy (QueryParam' mods paramName param :> api) -> GList gens -> Gen (BaseUrl -> Request) Source #

(KnownSymbol paramName, HasGen param gens, ToHttpApiData param, GenRequest api gens) => GenRequest (QueryParams paramName param :> api) gens Source #

Instance for generating query parameters for arrays of values

Instance details

Defined in Hedgehog.Servant

Methods

genRequest :: Proxy (QueryParams paramName param :> api) -> GList gens -> Gen (BaseUrl -> Request) Source #

GenRequest api gens => GenRequest (RemoteHost :> api) gens Source #

This instance doees not do anything right now

Note: in order to use features provided by this type in the API, you'll need to manually adjust the generated request.

Instance details

Defined in Hedgehog.Servant

Methods

genRequest :: Proxy (RemoteHost :> api) -> GList gens -> Gen (BaseUrl -> Request) Source #

(AllMimeRender contentTypes body, HasGen body gens, GenRequest api gens) => GenRequest (ReqBody' mods contentTypes body :> api) gens Source #

Instance for request body

Instance details

Defined in Hedgehog.Servant

Methods

genRequest :: Proxy (ReqBody' mods contentTypes body :> api) -> GList gens -> Gen (BaseUrl -> Request) Source #

GenRequest api gens => GenRequest (Vault :> api) gens Source #

This instance doees not do anything right now

Note: in order to use features provided by this type in the API, you'll need to manually adjust the generated request.

Instance details

Defined in Hedgehog.Servant

Methods

genRequest :: Proxy (Vault :> api) -> GList gens -> Gen (BaseUrl -> Request) Source #

(KnownSymbol path, GenRequest api reqs) => GenRequest (path :> api) reqs Source #

Instance for path part of API

Instance details

Defined in Hedgehog.Servant

Methods

genRequest :: Proxy (path :> api) -> GList reqs -> Gen (BaseUrl -> Request) Source #

GenRequest api gens => GenRequest (WithNamedContext x y api) gens Source #

This instance doees not do anything right now

Note: in order to use features provided by this type in the API, you'll need to manually adjust the generated request.

Instance details

Defined in Hedgehog.Servant

Methods

genRequest :: Proxy (WithNamedContext x y api) -> GList gens -> Gen (BaseUrl -> Request) Source #

ReflectMethod method => GenRequest (Verb method status contentTypes body) gens Source #

Instnace for capturing verb e.g. POST or GET

Instance details

Defined in Hedgehog.Servant

Methods

genRequest :: Proxy (Verb method status contentTypes body) -> GList gens -> Gen (BaseUrl -> Request) Source #