From d81f9c6ad72e0658ae849f32c191ca6c2792fbbf Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Tue, 28 Nov 2017 04:42:15 +0200 Subject: [PATCH] Fixed stable unit tests. --- hammond-data/src/database.rs | 2 +- hammond-data/src/parser.rs | 10 +++++----- hammond-downloader/src/downloader.rs | 4 +++- hammond-gtk/src/widgets/podcast.rs | 4 +++- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/hammond-data/src/database.rs b/hammond-data/src/database.rs index 25d7b60..c3f024e 100644 --- a/hammond-data/src/database.rs +++ b/hammond-data/src/database.rs @@ -64,7 +64,7 @@ fn run_migration_on(connection: &SqliteConnection) -> Result<()> { Ok(()) } -// Reset the database into a clean state. +/// Reset the database into a clean state. // Test share a Temp file db. #[allow(dead_code)] pub fn truncate_db() -> Result<()> { diff --git a/hammond-data/src/parser.rs b/hammond-data/src/parser.rs index f71a4e4..5ea6ce2 100644 --- a/hammond-data/src/parser.rs +++ b/hammond-data/src/parser.rs @@ -104,7 +104,7 @@ mod tests { "http://static.megaphone.fm/podcasts/d5735a50-d904-11e6-8532-73c7de466ea6/image/\ uploads_2F1484252190700-qhn5krasklbce3dh-a797539282700ea0298a3a26f7e49b0b_\ 2FIntercepted_COVER%2B_281_29.png" - ), + ) ); } @@ -123,7 +123,7 @@ mod tests { assert_eq!(pd.description(), descr); assert_eq!( pd.image_uri(), - Some("http://www.propublica.org/images/podcast_logo_2.png"), + Some("http://www.propublica.org/images/podcast_logo_2.png") ); } @@ -162,7 +162,7 @@ mod tests { assert_eq!(pd.description(), descr); assert_eq!( pd.image_uri(), - Some("https://request-for-explanation.github.io/podcast/podcast.png"), + Some("https://request-for-explanation.github.io/podcast/podcast.png") ); } @@ -226,7 +226,7 @@ mod tests { ); assert_eq!( i.uri(), - "http://tracking.feedpress.it/link/10581/6726758/20170908-cliff-levy.mp3", + "http://tracking.feedpress.it/link/10581/6726758/20170908-cliff-levy.mp3" ); assert_eq!(i.description(), Some(descr)); assert_eq!(i.length(), Some(33396551)); @@ -253,7 +253,7 @@ mod tests { ); assert_eq!( i2.uri(), - "http://tracking.feedpress.it/link/10581/6726759/16_JohnAllen-CRAFT.mp3".to_string(), + "http://tracking.feedpress.it/link/10581/6726759/16_JohnAllen-CRAFT.mp3".to_string() ); assert_eq!(i2.description(), Some(descr2)); assert_eq!(i2.length(), Some(17964071)); diff --git a/hammond-downloader/src/downloader.rs b/hammond-downloader/src/downloader.rs index 164599e..1362616 100644 --- a/hammond-downloader/src/downloader.rs +++ b/hammond-downloader/src/downloader.rs @@ -183,6 +183,7 @@ pub fn cache_image(pd: &Podcast) -> Option { mod tests { use super::*; use hammond_data::Source; + use hammond_data::feed::index; use hammond_data::dbqueries; use diesel::Identifiable; @@ -205,7 +206,8 @@ mod tests { let sid = source.id().clone(); // Convert Source it into a Feed and index it - source.into_feed().unwrap().index().unwrap(); + let feed = source.into_feed().unwrap(); + index(vec!(feed)); // Get the Podcast let pd = dbqueries::get_podcast_from_source_id(sid).unwrap(); diff --git a/hammond-gtk/src/widgets/podcast.rs b/hammond-gtk/src/widgets/podcast.rs index 0117a2c..810a51c 100644 --- a/hammond-gtk/src/widgets/podcast.rs +++ b/hammond-gtk/src/widgets/podcast.rs @@ -119,6 +119,7 @@ pub fn update_podcast_widget(stack: >k::Stack, pd: &Podcast) { #[cfg(test)] mod tests { use hammond_data::Source; + use hammond_data::feed::index; use diesel::Identifiable; use super::*; @@ -132,7 +133,8 @@ mod tests { let sid = source.id().clone(); // Convert Source it into a Feed and index it - source.into_feed().unwrap().index().unwrap(); + let feed = source.into_feed().unwrap(); + index(vec!(feed)); // Get the Podcast let pd = dbqueries::get_podcast_from_source_id(sid).unwrap();