Fixed stable unit tests.

This commit is contained in:
Jordan Petridis 2017-11-28 04:42:15 +02:00
parent 34e808182c
commit d81f9c6ad7
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6
4 changed files with 12 additions and 8 deletions

View File

@ -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<()> {

View File

@ -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));

View File

@ -183,6 +183,7 @@ pub fn cache_image(pd: &Podcast) -> Option<String> {
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();

View File

@ -119,6 +119,7 @@ pub fn update_podcast_widget(stack: &gtk::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();