Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data types for curl-runnings tests
- data AssertionFailure
- data CaseResult
- newtype CurlSuite = CurlSuite [CurlCase]
- data CurlCase = CurlCase {}
- data Header = Header Text Text
- data HeaderMatcher = HeaderMatcher [PartialHeaderMatcher]
- data Headers = HeaderSet [Header]
- data HttpMethod
- data JsonMatcher
- = Exactly Value
- | Contains [JsonSubExpr]
- data JsonSubExpr
- = ValueMatch Value
- | KeyValueMatch {
- matchKey :: Text
- matchValue :: Value
- data PartialHeaderMatcher = PartialHeaderMatcher (Maybe Text) (Maybe Text)
- data StatusCodeMatcher
- isFailing :: CaseResult -> Bool
- isPassing :: CaseResult -> Bool
Documentation
data AssertionFailure Source #
Represents the different type of test failures we can have. A single test case | might return many assertion failures.
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 |
HeaderFailure CurlCase HeaderMatcher Headers | The headers we got back were wrong |
UnexpectedFailure | Something else |
data CaseResult Source #
A type representing the result of a single curl, and all associated assertions
A wrapper type around a set of test cases. This is the top level spec type that we parse a test spec file into
A single curl test case, the basic foundation of a curl-runnings test.
CurlCase | |
|
A representation of a single header
data HeaderMatcher Source #
Collection of matchers to run against a single curl response
Simple container for a list of headers, useful for a vehicle for defining a fromJSON
data HttpMethod Source #
A basic enum for supported HTTP verbs
data JsonMatcher Source #
A predicate to apply to the json body from the response
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
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. |
|
data PartialHeaderMatcher Source #
Specify a key, value, or both to match against in the returned headers of a response.
data StatusCodeMatcher Source #
Check the status code of a response. You can specify one or many valid codes.
isFailing :: CaseResult -> Bool Source #
Simple predicate that checks if the result is failing
isPassing :: CaseResult -> Bool Source #
Simple predicate that checks if the result is passing