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 Source #

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] 

data CurlCase Source #

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

Constructors

CurlCase 

Fields

Instances

Show CurlCase Source # 
Generic CurlCase Source # 

Associated Types

type Rep CurlCase :: * -> * #

Methods

from :: CurlCase -> Rep CurlCase x #

to :: Rep CurlCase x -> CurlCase #

ToJSON CurlCase Source # 
FromJSON CurlCase Source # 
type Rep CurlCase Source # 

data HttpMethod Source #

A basic enum for supported HTTP verbs

Constructors

GET 
POST 
PUT 
PATCH 
DELETE 

Instances

Show HttpMethod Source # 
Generic HttpMethod Source # 

Associated Types

type Rep HttpMethod :: * -> * #

ToJSON HttpMethod Source # 
FromJSON HttpMethod Source # 
type Rep HttpMethod Source # 
type Rep HttpMethod = D1 * (MetaData "HttpMethod" "Testing.CurlRunnings.Types" "curl-runnings-0.2.0-7ZOt6BcdxJ79T8GBeV29kh" 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 Source #

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 Source #

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 Source #

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 Source #

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

isPassing :: CaseResult -> Bool Source #

Simple predicate that checks if the result is passing

isFailing :: CaseResult -> Bool Source #

Simple predicate that checks if the result is failing