1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 02:22:31 +01:00

Better check against internal server error exceptions during unit tests.

This commit is contained in:
kay.one 2012-02-25 11:57:56 -08:00
parent 67298d62a0
commit 11db27f6ac
4 changed files with 11 additions and 9 deletions

View File

@ -399,6 +399,7 @@ private static void Mark500Inconclusive()
ExceptionVerification.MarkInconclusive(typeof(WebException)); ExceptionVerification.MarkInconclusive(typeof(WebException));
ExceptionVerification.MarkInconclusive("System.Net.WebException"); ExceptionVerification.MarkInconclusive("System.Net.WebException");
ExceptionVerification.MarkInconclusive("(503) Server Unavailable."); ExceptionVerification.MarkInconclusive("(503) Server Unavailable.");
ExceptionVerification.MarkInconclusive("(500) Internal Server Error.");
} }
} }
} }

View File

@ -99,25 +99,25 @@ public virtual IList<EpisodeParseResult> FetchRss()
public virtual IList<EpisodeParseResult> FetchSeason(string seriesTitle, int seasonNumber) public virtual IList<EpisodeParseResult> FetchSeason(string seriesTitle, int seasonNumber)
{ {
_logger.Debug("Searching {0} for {1}-Season {2}", Name, seriesTitle, seasonNumber); _logger.Debug("Searching {0} for {1} Season {2}", Name, seriesTitle, seasonNumber);
var searchUrls = GetSeasonSearchUrls(GetQueryTitle(seriesTitle), seasonNumber); var searchUrls = GetSeasonSearchUrls(GetQueryTitle(seriesTitle), seasonNumber);
var result = Fetch(searchUrls); var result = Fetch(searchUrls);
_logger.Info("Finished searching {0} for {1}-S{2}, Found {3}", Name, seriesTitle, seasonNumber, result.Count); _logger.Info("Finished searching {0} for {1} Season {2}, Found {3}", Name, seriesTitle, seasonNumber, result.Count);
return result; return result;
} }
public virtual IList<EpisodeParseResult> FetchPartialSeason(string seriesTitle, int seasonNumber, int episodePrefix) public virtual IList<EpisodeParseResult> FetchPartialSeason(string seriesTitle, int seasonNumber, int episodePrefix)
{ {
_logger.Debug("Searching {0} for {1}-Season {2}, Prefix: {3}", Name, seriesTitle, seasonNumber, episodePrefix); _logger.Debug("Searching {0} for {1} Season {2}, Prefix: {3}", Name, seriesTitle, seasonNumber, episodePrefix);
var searchUrls = GetPartialSeasonSearchUrls(GetQueryTitle(seriesTitle), seasonNumber, episodePrefix); var searchUrls = GetPartialSeasonSearchUrls(GetQueryTitle(seriesTitle), seasonNumber, episodePrefix);
var result = Fetch(searchUrls); var result = Fetch(searchUrls);
_logger.Info("Finished searching {0} for {1}-S{2}, Found {3}", Name, seriesTitle, seasonNumber, result.Count); _logger.Info("Finished searching {0} for {1} Season {2}, Found {3}", Name, seriesTitle, seasonNumber, result.Count);
return result; return result;
} }
@ -129,7 +129,7 @@ public virtual IList<EpisodeParseResult> FetchEpisode(string seriesTitle, int se
var result = Fetch(searchUrls); var result = Fetch(searchUrls);
_logger.Info("Finished searching {0} for {1}-S{2}E{3:00}, Found {4}", Name, seriesTitle, seasonNumber, episodeNumber, result.Count); _logger.Info("Finished searching {0} for {1} S{2:00}E{3:00}, Found {4}", Name, seriesTitle, seasonNumber, episodeNumber, result.Count);
return result; return result;
} }

View File

@ -78,19 +78,18 @@ public static void MarkInconclusive(Type exception)
{ {
var inconclusiveLogs = _logs.Where(l => l.Exception != null && l.Exception.GetType() == exception).ToList(); var inconclusiveLogs = _logs.Where(l => l.Exception != null && l.Exception.GetType() == exception).ToList();
if (inconclusiveLogs.Count != 0) if (inconclusiveLogs.Any())
{ {
inconclusiveLogs.ForEach(c => _logs.Remove(c)); inconclusiveLogs.ForEach(c => _logs.Remove(c));
Assert.Inconclusive(GetLogsString(inconclusiveLogs)); Assert.Inconclusive(GetLogsString(inconclusiveLogs));
} }
} }
public static void MarkInconclusive(string text) public static void MarkInconclusive(string text)
{ {
var inconclusiveLogs = _logs.Where(l => l.FormattedMessage.Contains(text)).ToList(); var inconclusiveLogs = _logs.Where(l => l.FormattedMessage.ToLower().Contains(text.ToLower())).ToList();
if (inconclusiveLogs.Count != 0) if (inconclusiveLogs.Any())
{ {
inconclusiveLogs.ForEach(c => _logs.Remove(c)); inconclusiveLogs.ForEach(c => _logs.Remove(c));
Assert.Inconclusive(GetLogsString(inconclusiveLogs)); Assert.Inconclusive(GetLogsString(inconclusiveLogs));

View File

@ -71,6 +71,8 @@
background: lightgray; background: lightgray;
} }
.episodeMissing .episodeMissing
{ {
background-color: #f5c5c5; background-color: #f5c5c5;