Liking cljdoc? Tell your friends :D

sweet-tooth.endpoint.test.harness

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
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
raw docstring

*system*clj

source

assert-response-contains-entity-likecljmacro

(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`
sourceraw docstring

assert-response-contains-one-entity-likecljmacro

(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.
sourceraw docstring

base-requestclj

(base-request method url)
(base-request method url params-or-content-type)
(base-request method url params content-type)
source

base-request*cljmultimethod

source

comparison-entitiesclj

(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
sourceraw docstring

componentclj

(component component-key)

Look up component in current test system

Look up component in current test system
sourceraw docstring

contains-entity?clj

(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`.
sourceraw docstring

entity-segment?clj

(entity-segment? segment)
source

handlerclj

(handler)

The root handler for the system. Used to perform requests.

The root handler for the system. Used to perform requests.
sourceraw docstring

headersclj

(headers req headers)

Add all headers

Add all headers
sourceraw docstring

prep-comparisonclj

(prep-comparison resp-entity test-ent-attrs)

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.

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.
sourceraw docstring

read-bodycljmultimethod

Read body according to content type

Read body according to content type
sourceraw docstring

reqclj

(req & args)

Perform a request with the system's root handler

Perform a request with the system's root handler
sourceraw docstring

response-entitiesclj

(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
sourceraw docstring

system-fixtureclj

(system-fixture config-name)

To be used with use-fixtures

To be used with `use-fixtures`
sourceraw docstring

transit-inclj

(transit-in data)

An input stream of json-encoded transit. For request bodies.

An input stream of json-encoded transit. For request bodies.
sourceraw docstring

with-custom-systemcljmacro

(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.
sourceraw docstring

with-systemcljmacro

(with-system config-name & body)

Bind dynamic system var to a test system.

Bind dynamic system var to a test system.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close