tsk-204: Changing name of test payload function (#239)
* tsk-204: Changing name of test payload function * tsk-204: Added more test payload functions * tsk-204: Version bump
This commit was merged in pull request #239.
This commit is contained in:
Generated
+1
-1
@@ -964,7 +964,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "icarus"
|
name = "icarus"
|
||||||
version = "0.3.21"
|
version = "0.3.22"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"axum",
|
"axum",
|
||||||
"axum-extra",
|
"axum-extra",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "icarus"
|
name = "icarus"
|
||||||
version = "0.3.21"
|
version = "0.3.22"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
rust-version = "1.90"
|
rust-version = "1.90"
|
||||||
|
|
||||||
|
|||||||
+52
-20
@@ -497,10 +497,8 @@ mod tests {
|
|||||||
song_queue_id: &uuid::Uuid,
|
song_queue_id: &uuid::Uuid,
|
||||||
user_id: &uuid::Uuid,
|
user_id: &uuid::Uuid,
|
||||||
) -> Result<axum::response::Response, std::convert::Infallible> {
|
) -> Result<axum::response::Response, std::convert::Infallible> {
|
||||||
let payload = serde_json::json!({
|
let payload =
|
||||||
"song_queue_id": song_queue_id,
|
super::payload_data::link_user_to_queued_song(song_queue_id, user_id).await;
|
||||||
"user_id": user_id
|
|
||||||
});
|
|
||||||
|
|
||||||
let req = axum::http::Request::builder()
|
let req = axum::http::Request::builder()
|
||||||
.method(axum::http::Method::PATCH)
|
.method(axum::http::Method::PATCH)
|
||||||
@@ -612,7 +610,7 @@ mod tests {
|
|||||||
app: &axum::Router,
|
app: &axum::Router,
|
||||||
song_queue_id: &uuid::Uuid,
|
song_queue_id: &uuid::Uuid,
|
||||||
) -> Result<axum::response::Response, std::convert::Infallible> {
|
) -> 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()
|
let req = axum::http::Request::builder()
|
||||||
.method(axum::http::Method::POST)
|
.method(axum::http::Method::POST)
|
||||||
@@ -633,11 +631,11 @@ mod tests {
|
|||||||
coverart_id: &uuid::Uuid,
|
coverart_id: &uuid::Uuid,
|
||||||
song_queue_id: &uuid::Uuid,
|
song_queue_id: &uuid::Uuid,
|
||||||
) -> Result<axum::response::Response, std::convert::Infallible> {
|
) -> Result<axum::response::Response, std::convert::Infallible> {
|
||||||
let payload = serde_json::json!(
|
let payload = super::payload_data::link_queued_coverart_to_queued_song(
|
||||||
{
|
song_queue_id,
|
||||||
"song_queue_id": song_queue_id,
|
coverart_id,
|
||||||
"coverart_id" : coverart_id,
|
)
|
||||||
});
|
.await;
|
||||||
let req = axum::http::Request::builder()
|
let req = axum::http::Request::builder()
|
||||||
.method(axum::http::Method::PATCH)
|
.method(axum::http::Method::PATCH)
|
||||||
.uri(crate::callers::queue::endpoints::QUEUECOVERARTLINK)
|
.uri(crate::callers::queue::endpoints::QUEUECOVERARTLINK)
|
||||||
@@ -657,10 +655,8 @@ mod tests {
|
|||||||
song_id: &uuid::Uuid,
|
song_id: &uuid::Uuid,
|
||||||
coverart_id: &uuid::Uuid,
|
coverart_id: &uuid::Uuid,
|
||||||
) -> Result<axum::response::Response, std::convert::Infallible> {
|
) -> Result<axum::response::Response, std::convert::Infallible> {
|
||||||
let payload = serde_json::json!({
|
let payload = super::payload_data::create_coverart(song_id, coverart_id).await;
|
||||||
"song_id": song_id,
|
|
||||||
"coverart_queue_id": coverart_id
|
|
||||||
});
|
|
||||||
let req = axum::http::Request::builder()
|
let req = axum::http::Request::builder()
|
||||||
.method(axum::http::Method::POST)
|
.method(axum::http::Method::POST)
|
||||||
.uri(crate::callers::endpoints::CREATECOVERART)
|
.uri(crate::callers::endpoints::CREATECOVERART)
|
||||||
@@ -699,10 +695,8 @@ mod tests {
|
|||||||
app: &axum::Router,
|
app: &axum::Router,
|
||||||
song_queue_id: &uuid::Uuid,
|
song_queue_id: &uuid::Uuid,
|
||||||
) -> Result<axum::response::Response, std::convert::Infallible> {
|
) -> Result<axum::response::Response, std::convert::Infallible> {
|
||||||
let payload = serde_json::json!({
|
let payload =
|
||||||
"id": &song_queue_id,
|
super::payload_data::update_song_queue_status_to_ready(song_queue_id).await;
|
||||||
"status": crate::repo::queue::song::status::READY
|
|
||||||
});
|
|
||||||
|
|
||||||
let req = axum::http::Request::builder()
|
let req = axum::http::Request::builder()
|
||||||
.method(axum::http::Method::PATCH)
|
.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 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!(
|
serde_json::json!(
|
||||||
{
|
{
|
||||||
"song_queue_id": song_queue_id,
|
"song_queue_id": song_queue_id,
|
||||||
@@ -943,6 +936,45 @@ mod tests {
|
|||||||
"song_queue_id": song_queue_id
|
"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]
|
#[tokio::test]
|
||||||
|
|||||||
Reference in New Issue
Block a user