Posts editing tests
This commit is contained in:
@@ -289,6 +289,18 @@ impl TestApp {
|
||||
self.get_admin_dashboard().await.text().await.unwrap()
|
||||
}
|
||||
|
||||
pub async fn edit_post<Body>(&self, body: &Body, post_id: &Uuid) -> reqwest::Response
|
||||
where
|
||||
Body: serde::Serialize,
|
||||
{
|
||||
self.api_client
|
||||
.put(format!("{}/posts/{}", self.address, post_id))
|
||||
.form(body)
|
||||
.send()
|
||||
.await
|
||||
.expect("Failed to execute request")
|
||||
}
|
||||
|
||||
pub async fn get_posts(&self) -> reqwest::Response {
|
||||
self.api_client
|
||||
.get(format!("{}/posts", &self.address))
|
||||
@@ -301,7 +313,7 @@ impl TestApp {
|
||||
self.get_posts().await.text().await.unwrap()
|
||||
}
|
||||
|
||||
pub async fn get_post(&self, post_id: Uuid) -> reqwest::Response {
|
||||
pub async fn get_post(&self, post_id: &Uuid) -> reqwest::Response {
|
||||
self.api_client
|
||||
.get(format!("{}/posts/{}", &self.address, post_id))
|
||||
.send()
|
||||
@@ -309,7 +321,7 @@ impl TestApp {
|
||||
.expect("Failed to execute request")
|
||||
}
|
||||
|
||||
pub async fn get_post_html(&self, post_id: Uuid) -> String {
|
||||
pub async fn get_post_html(&self, post_id: &Uuid) -> String {
|
||||
self.get_post(post_id).await.text().await.unwrap()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user