Skip to main content

ApiResponse

Trait ApiResponse 

Source
pub trait ApiResponse {
    // Required methods
    fn assert_json_api_resource(
        &self,
        kind: Option<&str>,
        id: Option<&str>,
    ) -> &Self;
    fn assert_json_api_collection(
        &self,
        kind: Option<&str>,
        count: Option<usize>,
    ) -> &Self;
    fn assert_api_error(&self, code: impl ExpectedError) -> &Self;
    fn assert_idempotent_replay(&self) -> &Self;
    fn assert_not_idempotent_replay(&self) -> &Self;
    fn assert_deprecated(&self, sunset: Option<&str>) -> &Self;
    fn assert_not_deprecated(&self) -> &Self;
    fn assert_shape(&self, expected: Value) -> &Self;
}
Expand description

Fusion Stack’s assertions on a test response. Each returns the response, so they chain.

Required Methods§

Source

fn assert_json_api_resource( &self, kind: Option<&str>, id: Option<&str>, ) -> &Self

A successful JSON:API document whose data is one resource, of kind and id when given.

Source

fn assert_json_api_collection( &self, kind: Option<&str>, count: Option<usize>, ) -> &Self

A successful JSON:API document whose data is a list of resources, each of kind and count of them when given.

Source

fn assert_api_error(&self, code: impl ExpectedError) -> &Self

A JSON:API error document with an error of code. An ErrorCode also checks its status.

Source

fn assert_idempotent_replay(&self) -> &Self

The response was replayed from an earlier request with the same Idempotency-Key.

Source

fn assert_not_idempotent_replay(&self) -> &Self

The request ran: it was not replayed.

Source

fn assert_deprecated(&self, sunset: Option<&str>) -> &Self

The version the response was served in is deprecated, sunsetting on sunset (YYYY-MM-DD) when given.

Source

fn assert_not_deprecated(&self) -> &Self

The version the response was served in is not deprecated.

Source

fn assert_shape(&self, expected: Value) -> &Self

The body’s shape. Key order does not matter.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ApiResponse for TestResponse

Source§

fn assert_json_api_resource( &self, kind: Option<&str>, id: Option<&str>, ) -> &Self

Source§

fn assert_json_api_collection( &self, kind: Option<&str>, count: Option<usize>, ) -> &Self

Source§

fn assert_api_error(&self, code: impl ExpectedError) -> &Self

Source§

fn assert_idempotent_replay(&self) -> &Self

Source§

fn assert_not_idempotent_replay(&self) -> &Self

Source§

fn assert_deprecated(&self, sunset: Option<&str>) -> &Self

Source§

fn assert_not_deprecated(&self) -> &Self

Source§

fn assert_shape(&self, expected: Value) -> &Self

Implementors§