This commit is contained in:
Jordan Petridis 2018-03-03 16:45:37 +02:00
parent 3da503cdea
commit bb467b7aba
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6
5 changed files with 53 additions and 70 deletions

View File

@ -30,10 +30,7 @@ extern crate tempdir;
#[cfg(test)] #[cfg(test)]
lazy_static! { lazy_static! {
static ref TEMPDIR: tempdir::TempDir = { static ref TEMPDIR: tempdir::TempDir = { tempdir::TempDir::new("hammond_unit_test").unwrap() };
tempdir::TempDir::new("hammond_unit_test").unwrap()
};
static ref DB_PATH: PathBuf = TEMPDIR.path().join("hammond.db"); static ref DB_PATH: PathBuf = TEMPDIR.path().join("hammond.db");
} }

View File

@ -311,7 +311,6 @@ mod tests {
.build() .build()
.unwrap() .unwrap()
}; };
static ref EXPECTED_MINIMAL_INTERCEPTED_2: NewEpisodeMinimal = { static ref EXPECTED_MINIMAL_INTERCEPTED_2: NewEpisodeMinimal = {
NewEpisodeMinimalBuilder::default() NewEpisodeMinimalBuilder::default()
.title("Atlas Golfed — U.S.-Backed Think Tanks Target Latin America") .title("Atlas Golfed — U.S.-Backed Think Tanks Target Latin America")
@ -325,13 +324,12 @@ mod tests {
.build() .build()
.unwrap() .unwrap()
}; };
static ref EXPECTED_INTERCEPTED_1: NewEpisode = { static ref EXPECTED_INTERCEPTED_1: NewEpisode = {
let descr = "NSA whistleblower Edward Snowden discusses the massive Equifax data breach \ let descr = "NSA whistleblower Edward Snowden discusses the massive Equifax data \
and allegations of Russian interference in the US election. Commentator \ breach and allegations of Russian interference in the US election. \
Shaun King explains his call for a boycott of the NFL and talks about his \ Commentator Shaun King explains his call for a boycott of the NFL and \
campaign to bring violent neo-Nazis to justice. Rapper Open Mike Eagle \ talks about his campaign to bring violent neo-Nazis to justice. Rapper \
performs."; Open Mike Eagle performs.";
NewEpisodeBuilder::default() NewEpisodeBuilder::default()
.title("The Super Bowl of Racism") .title("The Super Bowl of Racism")
@ -347,16 +345,15 @@ mod tests {
.build() .build()
.unwrap() .unwrap()
}; };
static ref EXPECTED_INTERCEPTED_2: NewEpisode = { static ref EXPECTED_INTERCEPTED_2: NewEpisode = {
let descr = "This week on Intercepted: Jeremy gives an update on the aftermath of \ let descr = "This week on Intercepted: Jeremy gives an update on the aftermath of \
Blackwaters 2007 massacre of Iraqi civilians. Intercept reporter Lee Fang \ Blackwaters 2007 massacre of Iraqi civilians. Intercept reporter Lee \
lays out how a network of libertarian think tanks called the Atlas Network \ Fang lays out how a network of libertarian think tanks called the Atlas \
is insidiously shaping political infrastructure in Latin America. We speak \ Network is insidiously shaping political infrastructure in Latin \
with attorney and former Hugo Chavez adviser Eva Golinger about the \ America. We speak with attorney and former Hugo Chavez adviser Eva \
Venezuela\'s political turmoil.And we hear Claudia Lizardo of the \ Golinger about the Venezuela\'s political turmoil.And we hear Claudia \
Caracas-based band, La Pequeña Revancha, talk about her music and hopes for \ Lizardo of the Caracas-based band, La Pequeña Revancha, talk about her \
Venezuela."; music and hopes for Venezuela.";
NewEpisodeBuilder::default() NewEpisodeBuilder::default()
.title("Atlas Golfed — U.S.-Backed Think Tanks Target Latin America") .title("Atlas Golfed — U.S.-Backed Think Tanks Target Latin America")
@ -372,7 +369,6 @@ mod tests {
.build() .build()
.unwrap() .unwrap()
}; };
static ref UPDATED_DURATION_INTERCEPTED_1: NewEpisode = { static ref UPDATED_DURATION_INTERCEPTED_1: NewEpisode = {
NewEpisodeBuilder::default() NewEpisodeBuilder::default()
.title("The Super Bowl of Racism") .title("The Super Bowl of Racism")
@ -388,7 +384,6 @@ mod tests {
.build() .build()
.unwrap() .unwrap()
}; };
static ref EXPECTED_MINIMAL_LUP_1: NewEpisodeMinimal = { static ref EXPECTED_MINIMAL_LUP_1: NewEpisodeMinimal = {
NewEpisodeMinimalBuilder::default() NewEpisodeMinimalBuilder::default()
.title("Hacking Devices with Kali Linux | LUP 214") .title("Hacking Devices with Kali Linux | LUP 214")
@ -402,7 +397,6 @@ mod tests {
.build() .build()
.unwrap() .unwrap()
}; };
static ref EXPECTED_MINIMAL_LUP_2: NewEpisodeMinimal = { static ref EXPECTED_MINIMAL_LUP_2: NewEpisodeMinimal = {
NewEpisodeMinimalBuilder::default() NewEpisodeMinimalBuilder::default()
.title("Gnome Does it Again | LUP 213") .title("Gnome Does it Again | LUP 213")
@ -416,12 +410,11 @@ mod tests {
.build() .build()
.unwrap() .unwrap()
}; };
static ref EXPECTED_LUP_1: NewEpisode = { static ref EXPECTED_LUP_1: NewEpisode = {
let descr = "Audit your network with a couple of easy commands on Kali Linux. Chris \ let descr = "Audit your network with a couple of easy commands on Kali Linux. Chris \
decides to blow off a little steam by attacking his IoT devices, Wes has the \ decides to blow off a little steam by attacking his IoT devices, Wes has \
scope on Equifax blaming open source & the Beard just saved the show. \ the scope on Equifax blaming open source & the Beard just saved the \
Its a really packed episode!"; show. Its a really packed episode!";
NewEpisodeBuilder::default() NewEpisodeBuilder::default()
.title("Hacking Devices with Kali Linux | LUP 214") .title("Hacking Devices with Kali Linux | LUP 214")
@ -437,13 +430,13 @@ mod tests {
.build() .build()
.unwrap() .unwrap()
}; };
static ref EXPECTED_LUP_2: NewEpisode = { static ref EXPECTED_LUP_2: NewEpisode = {
let descr = "The Gnome project is about to solve one of our audience's biggest Waylands \ let descr = "The Gnome project is about to solve one of our audience's biggest \
concerns. But as the project takes on a new level of relevance, decisions for the \ Waylands concerns. But as the project takes on a new level of \
next version of Gnome have us worried about the future.\nPlus we chat with Wimpy \ relevance, decisions for the next version of Gnome have us worried about \
about the Ubuntu Rally in NYC, Microsofts sneaky move to turn Windows 10 into the \ the future.\nPlus we chat with Wimpy about the Ubuntu Rally in NYC, \
ULTIMATE LINUX RUNTIME, community news & more!"; Microsofts sneaky move to turn Windows 10 into the ULTIMATE LINUX \
RUNTIME, community news & more!";
NewEpisodeBuilder::default() NewEpisodeBuilder::default()
.title("Gnome Does it Again | LUP 213") .title("Gnome Does it Again | LUP 213")

View File

@ -165,10 +165,11 @@ mod tests {
lazy_static! { lazy_static! {
static ref EXPECTED_INTERCEPTED: NewPodcast = { static ref EXPECTED_INTERCEPTED: NewPodcast = {
let descr = "The people behind The Intercepts fearless reporting and incisive \ let descr = "The people behind The Intercepts fearless reporting and incisive \
commentaryJeremy Scahill, Glenn Greenwald, Betsy Reed and othersdiscuss \ commentaryJeremy Scahill, Glenn Greenwald, Betsy Reed and \
the crucial issues of our time: national security, civil liberties, foreign \ othersdiscuss the crucial issues of our time: national security, civil \
policy, and criminal justice. Plus interviews with artists, thinkers, and \ liberties, foreign policy, and criminal justice. Plus interviews with \
newsmakers who challenge our preconceptions about the world we live in."; artists, thinkers, and newsmakers who challenge our preconceptions about \
the world we live in.";
NewPodcastBuilder::default() NewPodcastBuilder::default()
.title("Intercepted with Jeremy Scahill") .title("Intercepted with Jeremy Scahill")
@ -183,11 +184,10 @@ mod tests {
.build() .build()
.unwrap() .unwrap()
}; };
static ref EXPECTED_LUP: NewPodcast = { static ref EXPECTED_LUP: NewPodcast = {
let descr = "An open show powered by community LINUX Unplugged takes the best attributes \ let descr = "An open show powered by community LINUX Unplugged takes the best \
of open collaboration and focuses them into a weekly lifestyle show about \ attributes of open collaboration and focuses them into a weekly \
Linux."; lifestyle show about Linux.";
NewPodcastBuilder::default() NewPodcastBuilder::default()
.title("LINUX Unplugged Podcast") .title("LINUX Unplugged Podcast")
@ -200,17 +200,16 @@ mod tests {
.build() .build()
.unwrap() .unwrap()
}; };
static ref EXPECTED_TIPOFF: NewPodcast = { static ref EXPECTED_TIPOFF: NewPodcast = {
let desc = "Welcome to The Tip Off- the podcast where we take you behind the scenes of \ let desc = "Welcome to The Tip Off- the podcast where we take you behind the scenes \
some of the best investigative journalism from recent years. Each episode \ of some of the best investigative journalism from recent years. Each \
well be digging into an investigative scoop- hearing from the journalists \ episode well be digging into an investigative scoop- hearing from the \
behind the work as they tell us about the leads, the dead-ends and of course, \ journalists behind the work as they tell us about the leads, the \
the tip offs. Therell be car chases, slammed doors, terrorist cells, \ dead-ends and of course, the tip offs. Therell be car chases, slammed \
meetings in dimly lit bars and cafes, wrangling with despotic regimes and \ doors, terrorist cells, meetings in dimly lit bars and cafes, wrangling \
much more. So if youre curious about the fun, complicated detective work \ with despotic regimes and much more. So if youre curious about the fun, \
that goes into doing great investigative journalism- then this is the podcast \ complicated detective work that goes into doing great investigative \
for you."; journalism- then this is the podcast for you.";
NewPodcastBuilder::default() NewPodcastBuilder::default()
.title("The Tip Off") .title("The Tip Off")
@ -223,15 +222,13 @@ mod tests {
.source_id(42) .source_id(42)
.build() .build()
.unwrap() .unwrap()
}; };
static ref EXPECTED_STARS: NewPodcast = { static ref EXPECTED_STARS: NewPodcast = {
let descr = "<p>The first audio drama from Tor Labs and Gideon Media, Steal the Stars is \ let descr = "<p>The first audio drama from Tor Labs and Gideon Media, Steal the Stars \
a gripping noir science fiction thriller in 14 episodes: Forbidden love, a \ is a gripping noir science fiction thriller in 14 episodes: Forbidden \
crashed UFO, an alien body, and an impossible heist unlike any ever \ love, a crashed UFO, an alien body, and an impossible heist unlike any \
attempted - scripted by Mac Rogers, the award-winning playwright and writer \ ever attempted - scripted by Mac Rogers, the award-winning playwright \
of the multi-million download The Message and LifeAfter.</p>"; and writer of the multi-million download The Message and LifeAfter.</p>";
let img = "https://dfkfj8j276wwv.cloudfront.net/images/2c/5f/a0/1a/2c5fa01a-ae78-4a8c-\ let img = "https://dfkfj8j276wwv.cloudfront.net/images/2c/5f/a0/1a/2c5fa01a-ae78-4a8c-\
b183-7311d2e436c3/b3a4aa57a576bb662191f2a6bc2a436c8c4ae256ecffaff5c4c54fd42e\ b183-7311d2e436c3/b3a4aa57a576bb662191f2a6bc2a436c8c4ae256ecffaff5c4c54fd42e\
923914941c264d01efb1833234b52c9530e67d28a8cebbe3d11a4bc0fbbdf13ecdf1c3.jpeg"; 923914941c264d01efb1833234b52c9530e67d28a8cebbe3d11a4bc0fbbdf13ecdf1c3.jpeg";
@ -245,11 +242,10 @@ mod tests {
.build() .build()
.unwrap() .unwrap()
}; };
static ref EXPECTED_CODE: NewPodcast = { static ref EXPECTED_CODE: NewPodcast = {
let descr = "A podcast about humans and technology. Panelists: Coraline Ada Ehmke, David \ let descr = "A podcast about humans and technology. Panelists: Coraline Ada Ehmke, \
Brady, Jessica Kerr, Jay Bobo, Astrid Countee and Sam Livingston-Gray. \ David Brady, Jessica Kerr, Jay Bobo, Astrid Countee and Sam \
Brought to you by @therubyrep."; Livingston-Gray. Brought to you by @therubyrep.";
NewPodcastBuilder::default() NewPodcastBuilder::default()
.title("Greater Than Code") .title("Greater Than Code")
@ -262,7 +258,6 @@ mod tests {
.build() .build()
.unwrap() .unwrap()
}; };
static ref UPDATED_DESC_INTERCEPTED: NewPodcast = { static ref UPDATED_DESC_INTERCEPTED: NewPodcast = {
NewPodcastBuilder::default() NewPodcastBuilder::default()
.title("Intercepted with Jeremy Scahill") .title("Intercepted with Jeremy Scahill")

View File

@ -73,9 +73,8 @@ impl DownloadProgress for Progress {
} }
lazy_static! { lazy_static! {
pub static ref ACTIVE_DOWNLOADS: Arc<RwLock<HashMap<i32, Arc<Mutex<Progress>>>>> = { pub static ref ACTIVE_DOWNLOADS: Arc<RwLock<HashMap<i32, Arc<Mutex<Progress>>>>> =
Arc::new(RwLock::new(HashMap::new())) { Arc::new(RwLock::new(HashMap::new())) };
};
} }
pub fn add(id: i32, directory: &str, sender: Sender<Action>) -> Result<(), Error> { pub fn add(id: i32, directory: &str, sender: Sender<Action>) -> Result<(), Error> {

View File

@ -74,9 +74,8 @@ fn refresh_feed(source: Option<Vec<Source>>, sender: Sender<Action>) -> Result<(
} }
lazy_static! { lazy_static! {
static ref CACHED_PIXBUFS: RwLock<HashMap<(i32, u32), Mutex<SendCell<Pixbuf>>>> = { static ref CACHED_PIXBUFS: RwLock<HashMap<(i32, u32), Mutex<SendCell<Pixbuf>>>> =
RwLock::new(HashMap::new()) { RwLock::new(HashMap::new()) };
};
} }
// Since gdk_pixbuf::Pixbuf is refference counted and every episode, // Since gdk_pixbuf::Pixbuf is refference counted and every episode,