curl-runnings-0.2.0: A framework for declaratively writing curl based API tests

Safe HaskellNone
LanguageHaskell2010

Testing.CurlRunnings.Types

Description

Data types for curl-runnings tests

Synopsis

Documentation

newtype CurlSuite #

A wrapper type around a set of test cases. This is the top level spec type that we parse a test spec file into

Constructors

CurlSuite [CurlCase] 

Instances

Show CurlSuite # 
Generic CurlSuite # 

Associated Types

type Rep CurlSuite :: * -> * #

ToJSON CurlSuite # 
FromJSON CurlSuite # 
type Rep CurlSuite # 
type Rep CurlSuite = D1 * (MetaData "CurlSuite" "Testing.CurlRunnings.Types" "curl-runnings-0.2.0-8DdrqovPAGfBd9OZfKlrqI" True) (C1 * (MetaCons "CurlSuite" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * [CurlCase])))

data CurlCase #

A single curl test case, the basic foundation of a curl-runnings test.

Constructors

CurlCase 

Fields

data HttpMethod #

A basic enum for supported HTTP verbs

Constructors

GET 
POST 
PUT 
PATCH 
DELETE 

Instances

Show HttpMethod # 
Generic HttpMethod # 

Associated Types

type Rep HttpMethod :: * -> * #

ToJSON HttpMethod # 
FromJSON HttpMethod # 
type Rep HttpMethod # 
type Rep HttpMethod = D1 * (MetaData "HttpMethod" "Testing.CurlRunnings.Types" "curl-runnings-0.2.0-8DdrqovPAGfBd9OZfKlrqI" False) ((:+:) * ((:+:) * (C1 * (MetaCons "GET" PrefixI False) (U1 *)) (C1 * (MetaCons "POST" PrefixI False) (U1 *))) ((:+:) * (C1 * (MetaCons "PUT" PrefixI False) (U1 *)) ((:+:) * (C1 * (MetaCons "PATCH" PrefixI False) (U1 *)) (C1 * (MetaCons "DELETE" PrefixI False) (U1 *)))))

data JsonMatcher #

A predicate to apply to the json body from the response

Constructors

Exactly Value

Performs ==

Contains [JsonSubExpr]

A list of matchers to make assertions about some subset of the response.

data JsonSubExpr #

A matcher for a subvalue of a json payload

Constructors

ValueMatch Value

Assert some value anywhere in the json has a value equal to a given value. The motivation for this field is largely for checking contents of a top level array. It's also useful if you don't know the key ahead of time.

KeyValueMatch

Assert the key value pair can be found somewhere the json.

Fields

data AssertionFailure #

Represents the different type of test failures we can have. A single test case | might return many assertion failures.

Constructors

DataFailure CurlCase JsonMatcher (Maybe Value)

The json we got back was wrong. We include this redundant field (it's included in the CurlCase field above) in order to enforce at the type level that we have to be expecting some data in order to have this type of failure.

StatusFailure CurlCase Int

The status code we got back was wrong

UnexpectedFailure

Something else

data CaseResult #

A type representing the result of a single curl, and all associated assertions

isPassing :: CaseResult -> Bool #

Simple predicate that checks if the result is passing

isFailing :: CaseResult -> Bool #

Simple predicate that checks if the result is failing