Includes:
read-body
multimethod for parsing response bodies of different types (transit, json etc)Includes: * Macros and a fixture for dealing with a system for the duration of a test * Helpers for composing and dispatching requests * `read-body` multimethod for parsing response bodies of different types (transit, json etc) * assertions that work with response segments
(assert-response-contains-entity-like resp-data test-ent-attrs)
(assert-response-contains-entity-like resp-data ent-type test-ent-attrs)
Request's response data creates entity of type ent-type
(optional)
that has key/value pairs identical to test-ent-attrs
Request's response data creates entity of type `ent-type` (optional) that has key/value pairs identical to `test-ent-attrs`
(assert-response-contains-one-entity-like resp-data test-ent-attrs)
(assert-response-contains-one-entity-like resp-data ent-type test-ent-attrs)
Request's response contains only one entity, and that entity is like
test-ent-attrs
. Advantage of using this over
assert-response-contains-entity-like
is it uses (is (= ...))
, so
in test reports you get the diff between expected and actual.
Request's response contains only one entity, and that entity is like `test-ent-attrs`. Advantage of using this over `assert-response-contains-entity-like` is it uses `(is (= ...))`, so in test reports you get the diff between expected and actual.
(base-request method url)
(base-request method url params-or-content-type)
(base-request method url params content-type)
(comparison-entities test-ent-attrs resp-data)
(comparison-entities test-ent-attrs ent-type resp-data)
Returns a set that can be used to test if test-ent-attrs
is
contained in a response
Returns a set that can be used to test if `test-ent-attrs` is contained in a response
(component component-key)
Look up component in current test system
Look up component in current test system
(contains-entity? resp-data test-ent-attrs)
(contains-entity? resp-data ent-type test-ent-attrs)
Request's response data creates entity of type ent-type
that has
key/value pairs identical to test-ent-attrs
.
Request's response data creates entity of type `ent-type` that has key/value pairs identical to `test-ent-attrs`.
(handler)
The root handler for the system. Used to perform requests.
The root handler for the system. Used to perform requests.
(prep-comparison resp-entity test-ent-attrs)
When testing whether a response contains test-ent-attrs
, we modify
a response entity by:
selecting only the keys that are present in
test-ent-attrs
. This allows us to do an =
comparison that won't
fail if the response entity contains attributes we don't want to
test.
Putting the result in a map to handle case where resp-entity
is
a map.
When testing whether a response contains `test-ent-attrs`, we modify a response entity by: 1. selecting only the keys that are present in `test-ent-attrs`. This allows us to do an `=` comparison that won't fail if the response entity contains attributes we don't want to test. 2. Putting the result in a map to handle case where `resp-entity` is a map.
Read body according to content type
Read body according to content type
(req & args)
Perform a request with the system's root handler
Perform a request with the system's root handler
(response-entities resp-data)
(response-entities ent-type resp-data)
Walk response data and return all entities from entity segments
Walk response data and return all entities from entity segments
(system)
more assertive system retrieval
more assertive system retrieval
(system-fixture config-name)
To be used with use-fixtures
To be used with `use-fixtures`
(transit-in data)
An input stream of json-encoded transit. For request bodies.
An input stream of json-encoded transit. For request bodies.
(with-custom-system config-name custom-config & body)
Bind dynamic system var to a test system with a custom config.
Bind dynamic system var to a test system with a custom config.
(with-system config-name & body)
Bind dynamic system var to a test system.
Bind dynamic system var to a test system.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close