Fixed: Size Parsing in TorrentRss was a bit too tolerant.

fixes #590
This commit is contained in:
Taloth Saldono
2015-06-04 21:08:24 +02:00
parent cd5b00afa8
commit ccff4fe142
6 changed files with 891 additions and 15 deletions
@@ -14,12 +14,25 @@ namespace NzbDrone.Core.Test.IndexerTests
[TestCase("162.1MB", 169974170)]
[TestCase("398.62 MB", 417983365)]
[TestCase("845 MB", 886046720)]
public void parse_size(string sizeString, long expectedSize)
[TestCase("7,162,100.0KB", 7333990400)]
[TestCase("12341234", 12341234)]
public void should_parse_size(string sizeString, long expectedSize)
{
var result = RssParser.ParseSize(sizeString, true);
result.Should().Be(expectedSize);
}
[TestCase("100 Kbps")]
[TestCase("100 Kb/s")]
[TestCase(" 12341234")]
[TestCase("12341234 other")]
public void should_not_parse_size(string sizeString)
{
var result = RssParser.ParseSize(sizeString, true);
result.Should().Be(0);
}
}
}
@@ -120,6 +120,23 @@ namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests
});
}
[Test]
public void should_detect_rss_settings_for_BitHdtv()
{
GivenRecentFeedResponse("TorrentRss/BitHdtv.xml");
var settings = Subject.Detect(_indexerSettings);
settings.ShouldBeEquivalentTo(new TorrentRssIndexerParserSettings
{
UseEZTVFormat = false,
UseEnclosureLength = false,
ParseSizeInDescription = false,
ParseSeedersInDescription = false,
SizeElementName = "size"
});
}
[Test]
[Ignore("Cannot reliably reject unparseable titles")]
public void should_reject_rss_settings_for_AwesomeHD()