Fixed: QueueSpecificationFixture Tests and Misc Others

This commit is contained in:
Qstick 2017-12-24 00:34:21 -05:00
parent bfbdba14f6
commit 8b7b2e6a83
4 changed files with 17 additions and 16 deletions

View File

@ -305,7 +305,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
_reports = new List<ReleaseInfo>
{
new ReleaseInfo{Title = "The.Office.S03E115.DVDRip.XviD-OSiTV"},
new ReleaseInfo{Title = "Alien Ant Farm - TruAnt (FLAC) DRONE"},
};
Subject.GetRssDecision(_reports).Should().HaveCount(1);

View File

@ -40,7 +40,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
{
Languages = Languages.LanguageFixture.GetDefaultLanguages(),
Cutoff = Language.Spanish
}).Build();
})
.Build();
_album = Builder<Album>.CreateNew()
.With(e => e.ArtistId = _artist.Id)
@ -89,7 +90,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
}
[Test]
public void should_return_true_when_series_doesnt_match()
public void should_return_true_when_artist_doesnt_match()
{
var remoteAlbum = Builder<RemoteAlbum>.CreateNew()
.With(r => r.Artist = _otherArtist)
@ -193,14 +194,14 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void should_return_false_when_quality_in_queue_is_better()
{
_artist.Profile.Value.Cutoff = Quality.MP3_320.Id;
_artist.Profile.Value.Cutoff = Quality.FLAC.Id;
var remoteAlbum = Builder<RemoteAlbum>.CreateNew()
.With(r => r.Artist = _artist)
.With(r => r.Albums = new List<Album> { _album })
.With(r => r.ParsedAlbumInfo = new ParsedAlbumInfo
{
Quality = new QualityModel(Quality.MP3_256),
Quality = new QualityModel(Quality.MP3_320),
Language = Language.English
})
.Build();
@ -217,7 +218,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
.With(r => r.Albums = new List<Album> { _album, _otherAlbum })
.With(r => r.ParsedAlbumInfo = new ParsedAlbumInfo
{
Quality = new QualityModel(Quality.MP3_256),
Quality = new QualityModel(Quality.MP3_320),
Language = Language.English
})
.Build();
@ -234,7 +235,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
.With(r => r.Albums = new List<Album> { _album })
.With(r => r.ParsedAlbumInfo = new ParsedAlbumInfo
{
Quality = new QualityModel(Quality.MP3_256),
Quality = new QualityModel(Quality.MP3_320),
Language = Language.English
})
.Build();
@ -253,7 +254,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
.With(r => r.Albums = new List<Album> { _album, _otherAlbum })
.With(r => r.ParsedAlbumInfo = new ParsedAlbumInfo
{
Quality = new QualityModel(Quality.MP3_256),
Quality = new QualityModel(Quality.MP3_320),
Language = Language.English
})
.Build();
@ -265,14 +266,14 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
}
[Test]
public void should_return_false_if_multi_part_album_has_two_episodes_in_queue()
public void should_return_false_if_multi_part_album_has_two_albums_in_queue()
{
var remoteAlbums = Builder<RemoteAlbum>.CreateListOfSize(2)
.All()
.With(r => r.Artist = _artist)
.With(r => r.ParsedAlbumInfo = new ParsedAlbumInfo
{
Quality = new QualityModel(Quality.MP3_256),
Quality = new QualityModel(Quality.MP3_320),
Language = Language.English
})
.TheFirst(1)

View File

@ -84,6 +84,7 @@ namespace NzbDrone.Core.Test.ParserTests
};
[Test, TestCaseSource(nameof(HashedReleaseParserCases))]
[Ignore("Hashed code is not currently called with track parsing")]
public void should_properly_parse_hashed_releases(string path, string title, Quality quality, string releaseGroup)
{
var result = Parser.Parser.ParseMusicPath(path);

View File

@ -1,4 +1,3 @@
using System;
using System.Linq;
using NLog;
using NzbDrone.Core.IndexerSearch.Definitions;
@ -14,11 +13,11 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
private readonly Logger _logger;
public QueueSpecification(IQueueService queueService,
UpgradableSpecification qualityUpgradableSpecification,
UpgradableSpecification upgradableSpecification,
Logger logger)
{
_queueService = queueService;
_upgradableSpecification = qualityUpgradableSpecification;
_upgradableSpecification = upgradableSpecification;
_logger = logger;
}
@ -35,7 +34,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
foreach (var remoteAlbum in matchingAlbum)
{
_logger.Debug("Checking if existing release in queue meets cutoff. Queued quality is: {0}", remoteAlbum.ParsedAlbumInfo.Quality);
_logger.Debug("Checking if existing release in queue meets cutoff. Queued quality is: {0} - {1}", remoteAlbum.ParsedAlbumInfo.Quality, remoteAlbum.ParsedAlbumInfo.Language);
if (!_upgradableSpecification.CutoffNotMet(subject.Artist.Profile,
subject.Artist.LanguageProfile,
@ -46,7 +45,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
return Decision.Reject("Quality for release in queue already meets cutoff: {0}", remoteAlbum.ParsedAlbumInfo.Quality);
}
_logger.Debug("Checking if release is higher quality than queued release. Queued quality is: {0}", remoteAlbum.ParsedAlbumInfo.Quality);
_logger.Debug("Checking if release is higher quality than queued release. Queued quality is: {0} - {1}", remoteAlbum.ParsedAlbumInfo.Quality, remoteAlbum.ParsedAlbumInfo.Language);
if (!_upgradableSpecification.IsUpgradable(subject.Artist.Profile,
subject.Artist.LanguageProfile,
@ -55,7 +54,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
subject.ParsedAlbumInfo.Quality,
subject.ParsedAlbumInfo.Language))
{
return Decision.Reject("Quality for release in queue is of equal or higher preference: {0}", remoteAlbum.ParsedAlbumInfo.Quality);
return Decision.Reject("Quality for release in queue is of equal or higher preference: {0} - {1}", remoteAlbum.ParsedAlbumInfo.Quality, remoteAlbum.ParsedAlbumInfo.Language);
}
}