Additional Questions

These are the Questions added in ScreenPy Requests.

BodyOfTheLastResponse

Aliases: Body, TheBody, TheBodyOfTheLastResponse

class BodyOfTheLastResponse

Ask about the body of the last API response received by the Actor.

If you are expecting a JSON response, this Question can be indexed to return only a section of that response. See the examples below.

If you are expecting a text response, you can also slice the text.

Abilities Required:

MakeAPIRequests

Examples:

# JSON response
the_actor.should(
    See.the(BodyOfTheLastResponse(), ContainsTheEntry(play="Hamlet"))
)

# JSON response, picked
the_actor.should(
    See.the(
        BodyOfTheLastResponse()["users"][0]["first_name"],
        ReadsExactly("Monty")
    ),
)

# text response
the_actor.should(
    See.the(BodyOfTheLastResponse(), ReadsExactly("To be, or not to be"))
)

# text response, sliced
the_actor.should(
    See.the(BodyOfTheLastResponse()[6:12], ReadsExactly("Python"))
)

Cookies

Aliases: TheCookies

class Cookies

Ask about the cookies on the Actor’s API session.

Abilities Required:

MakeAPIRequests

Examples:

the_actor.should(
    See.the(Cookies(), ContainTheEntry(type="snickerdoodle"))
)

HeadersOfTheLastResponse

Aliases: Headers, TheHeaders, TheHeadersOfTheLastResponse

class HeadersOfTheLastResponse

Ask about the headers of the last API response received.

Abilities Required:

MakeAPIRequests

Examples:

the_actor.should(
    See.the(HeadersOfTheLastResponse(), ContainsKey("Content-Type"))
)

StatusCodeOfTheLastResponse

Aliases: StatusCode, TheStatusCode, TheStatusCodeOfTheLastResponse

class StatusCodeOfTheLastResponse

Ask about the status code of the last API response received.

Abilities Required:

MakeAPIRequests

Examples:

the_actor.should(
    See.the(StatusCodeOfTheLastResponse(), IsEqualTo(200))
)