tsk-204: Changing name of test payload function #239
Generated
+1
-1
@@ -964,7 +964,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "icarus"
|
||||
version = "0.3.21"
|
||||
version = "0.3.22"
|
||||
dependencies = [
|
||||
"axum",
|
||||
"axum-extra",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "icarus"
|
||||
version = "0.3.21"
|
||||
version = "0.3.22"
|
||||
edition = "2024"
|
||||
rust-version = "1.90"
|
||||
|
||||
|
||||
+52
-20
@@ -497,10 +497,8 @@ mod tests {
|
||||
song_queue_id: &uuid::Uuid,
|
||||
user_id: &uuid::Uuid,
|
||||
) -> Result<axum::response::Response, std::convert::Infallible> {
|
||||
let payload = serde_json::json!({
|
||||
"song_queue_id": song_queue_id,
|
||||
"user_id": user_id
|
||||
});
|
||||
let payload =
|
||||
super::payload_data::link_user_to_queued_song(song_queue_id, user_id).await;
|
||||
|
||||
let req = axum::http::Request::builder()
|
||||
.method(axum::http::Method::PATCH)
|
||||
@@ -612,7 +610,7 @@ mod tests {
|
||||
app: &axum::Router,
|
||||
song_queue_id: &uuid::Uuid,
|
||||
) -> Result<axum::response::Response, std::convert::Infallible> {
|
||||
let payload = super::payload_data::queue_metadata_payload_data(&song_queue_id).await;
|
||||
let payload = super::payload_data::queue_metadata(&song_queue_id).await;
|
||||
|
||||
let req = axum::http::Request::builder()
|
||||
.method(axum::http::Method::POST)
|
||||
@@ -633,11 +631,11 @@ mod tests {
|
||||
coverart_id: &uuid::Uuid,
|
||||
song_queue_id: &uuid::Uuid,
|
||||
) -> Result<axum::response::Response, std::convert::Infallible> {
|
||||
let payload = serde_json::json!(
|
||||
{
|
||||
"song_queue_id": song_queue_id,
|
||||
"coverart_id" : coverart_id,
|
||||
});
|
||||
let payload = super::payload_data::link_queued_coverart_to_queued_song(
|
||||
song_queue_id,
|
||||
coverart_id,
|
||||
)
|
||||
.await;
|
||||
let req = axum::http::Request::builder()
|
||||
.method(axum::http::Method::PATCH)
|
||||
.uri(crate::callers::queue::endpoints::QUEUECOVERARTLINK)
|
||||
@@ -657,10 +655,8 @@ mod tests {
|
||||
song_id: &uuid::Uuid,
|
||||
coverart_id: &uuid::Uuid,
|
||||
) -> Result<axum::response::Response, std::convert::Infallible> {
|
||||
let payload = serde_json::json!({
|
||||
"song_id": song_id,
|
||||
"coverart_queue_id": coverart_id
|
||||
});
|
||||
let payload = super::payload_data::create_coverart(song_id, coverart_id).await;
|
||||
|
||||
let req = axum::http::Request::builder()
|
||||
.method(axum::http::Method::POST)
|
||||
.uri(crate::callers::endpoints::CREATECOVERART)
|
||||
@@ -699,10 +695,8 @@ mod tests {
|
||||
app: &axum::Router,
|
||||
song_queue_id: &uuid::Uuid,
|
||||
) -> Result<axum::response::Response, std::convert::Infallible> {
|
||||
let payload = serde_json::json!({
|
||||
"id": &song_queue_id,
|
||||
"status": crate::repo::queue::song::status::READY
|
||||
});
|
||||
let payload =
|
||||
super::payload_data::update_song_queue_status_to_ready(song_queue_id).await;
|
||||
|
||||
let req = axum::http::Request::builder()
|
||||
.method(axum::http::Method::PATCH)
|
||||
@@ -902,9 +896,8 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Change the name of the function to be more expressive and put into it's own module
|
||||
pub mod payload_data {
|
||||
pub async fn queue_metadata_payload_data(song_queue_id: &uuid::Uuid) -> serde_json::Value {
|
||||
pub async fn queue_metadata(song_queue_id: &uuid::Uuid) -> serde_json::Value {
|
||||
serde_json::json!(
|
||||
{
|
||||
"song_queue_id": song_queue_id,
|
||||
@@ -943,6 +936,45 @@ mod tests {
|
||||
"song_queue_id": song_queue_id
|
||||
})
|
||||
}
|
||||
|
||||
pub async fn link_user_to_queued_song(
|
||||
song_queue_id: &uuid::Uuid,
|
||||
user_id: &uuid::Uuid,
|
||||
) -> serde_json::Value {
|
||||
serde_json::json!({
|
||||
"song_queue_id": song_queue_id,
|
||||
"user_id": user_id
|
||||
})
|
||||
}
|
||||
|
||||
pub async fn link_queued_coverart_to_queued_song(
|
||||
song_queue_id: &uuid::Uuid,
|
||||
coverart_queue_id: &uuid::Uuid,
|
||||
) -> serde_json::Value {
|
||||
serde_json::json!({
|
||||
"song_queue_id": song_queue_id,
|
||||
"coverart_id": coverart_queue_id
|
||||
})
|
||||
}
|
||||
|
||||
pub async fn create_coverart(
|
||||
song_id: &uuid::Uuid,
|
||||
coverart_queue_id: &uuid::Uuid,
|
||||
) -> serde_json::Value {
|
||||
serde_json::json!({
|
||||
"song_id": song_id,
|
||||
"coverart_queue_id": coverart_queue_id
|
||||
})
|
||||
}
|
||||
|
||||
pub async fn update_song_queue_status_to_ready(
|
||||
song_queue_id: &uuid::Uuid,
|
||||
) -> serde_json::Value {
|
||||
serde_json::json!({
|
||||
"id": song_queue_id,
|
||||
"status": crate::repo::queue::song::status::READY
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
||||
Reference in New Issue
Block a user