Formatting
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
use shanty_db::entities::download_queue::DownloadStatus;
|
||||
use shanty_db::{Database, queries};
|
||||
use shanty_dl::backend::{AudioFormat, BackendConfig, DownloadBackend, DownloadResult, DownloadTarget, SearchResult};
|
||||
use shanty_dl::backend::{
|
||||
AudioFormat, BackendConfig, DownloadBackend, DownloadResult, DownloadTarget, SearchResult,
|
||||
};
|
||||
use shanty_dl::error::DlResult;
|
||||
use shanty_dl::queue::{run_queue, download_single};
|
||||
use shanty_dl::queue::{download_single, run_queue};
|
||||
use tempfile::TempDir;
|
||||
|
||||
/// Mock backend for testing without yt-dlp.
|
||||
@@ -84,7 +86,9 @@ async fn test_queue_process_success() {
|
||||
.unwrap();
|
||||
|
||||
// Process queue
|
||||
let stats = run_queue(db.conn(), &backend, &config, false).await.unwrap();
|
||||
let stats = run_queue(db.conn(), &backend, &config, false)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(stats.downloads_attempted, 1);
|
||||
assert_eq!(stats.downloads_completed, 1);
|
||||
assert_eq!(stats.downloads_failed, 0);
|
||||
@@ -112,7 +116,9 @@ async fn test_queue_process_failure() {
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let stats = run_queue(db.conn(), &backend, &config, false).await.unwrap();
|
||||
let stats = run_queue(db.conn(), &backend, &config, false)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(stats.downloads_attempted, 1);
|
||||
assert_eq!(stats.downloads_failed, 1);
|
||||
|
||||
@@ -218,9 +224,17 @@ async fn test_wanted_item_status_updated_on_download() {
|
||||
};
|
||||
|
||||
// Create a wanted item
|
||||
let wanted = queries::wanted::add(db.conn(), ItemType::Track, "Wanted Song", None, None, None, None)
|
||||
.await
|
||||
.unwrap();
|
||||
let wanted = queries::wanted::add(
|
||||
db.conn(),
|
||||
ItemType::Track,
|
||||
"Wanted Song",
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(wanted.status, WantedStatus::Wanted);
|
||||
|
||||
// Enqueue download linked to the wanted item
|
||||
@@ -229,7 +243,9 @@ async fn test_wanted_item_status_updated_on_download() {
|
||||
.unwrap();
|
||||
|
||||
// Process queue
|
||||
run_queue(db.conn(), &backend, &config, false).await.unwrap();
|
||||
run_queue(db.conn(), &backend, &config, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
// Wanted item should now be Downloaded
|
||||
let updated = queries::wanted::get_by_id(db.conn(), wanted.id)
|
||||
|
||||
Reference in New Issue
Block a user