pub struct TestResponse { /* private fields */ }Implementations§
Source§impl TestResponse
impl TestResponse
pub fn status(&self) -> u16
pub fn body(&self) -> &str
pub fn header(&self, name: &str) -> Option<&str>
Sourcepub fn json(&self) -> Value
pub fn json(&self) -> Value
The body as JSON, panicking with the raw body if it is not JSON — which is usually a 500 page and exactly what you need to see.
pub fn assert_status(self, expected: u16) -> Self
pub fn assert_ok(self) -> Self
pub fn assert_created(self) -> Self
pub fn assert_no_content(self) -> Self
pub fn assert_forbidden(self) -> Self
pub fn assert_not_found(self) -> Self
pub fn assert_header(self, name: &str, expected: &str) -> Self
Sourcepub fn assert_json_path(self, path: &str, expected: impl Into<Value>) -> Self
pub fn assert_json_path(self, path: &str, expected: impl Into<Value>) -> Self
Assert a value at a dotted path: data.0.name.
Sourcepub fn assert_json_count(self, path: &str, expected: usize) -> Self
pub fn assert_json_count(self, path: &str, expected: usize) -> Self
Assert the length of an array at a dotted path.
Sourcepub fn assert_validation_message(self, field: &str, expected: &str) -> Self
pub fn assert_validation_message(self, field: &str, expected: &str) -> Self
Assert a specific validation message for a field.
Saves reaching for assert_json_path("errors.email.0", ..) and getting
the prefix wrong, which is the mistake everyone makes once.
Sourcepub fn assert_validation_errors(self, fields: &[&str]) -> Self
pub fn assert_validation_errors(self, fields: &[&str]) -> Self
Assert a 422 naming exactly these fields — the shape Luxid’s validation errors take.
Auto Trait Implementations§
impl Freeze for TestResponse
impl RefUnwindSafe for TestResponse
impl Send for TestResponse
impl Sync for TestResponse
impl Unpin for TestResponse
impl UnsafeUnpin for TestResponse
impl UnwindSafe for TestResponse
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more