mirror of
https://github.com/lidarr/Lidarr
synced 2024-12-26 09:37:12 +00:00
Fixed: QueueSpecificationFixture Tests and Misc Others
This commit is contained in:
parent
bfbdba14f6
commit
8b7b2e6a83
4 changed files with 17 additions and 16 deletions
|
@ -305,7 +305,7 @@ public void should_return_a_decision_when_exception_is_caught()
|
|||
|
||||
_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);
|
||||
|
|
|
@ -40,7 +40,8 @@ public void Setup()
|
|||
{
|
||||
Languages = Languages.LanguageFixture.GetDefaultLanguages(),
|
||||
Cutoff = Language.Spanish
|
||||
}).Build();
|
||||
})
|
||||
.Build();
|
||||
|
||||
_album = Builder<Album>.CreateNew()
|
||||
.With(e => e.ArtistId = _artist.Id)
|
||||
|
@ -89,7 +90,7 @@ public void should_return_true_when_queue_is_empty()
|
|||
}
|
||||
|
||||
[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 @@ public void should_return_true_when_qualities_are_the_same_but_language_is_bette
|
|||
[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 @@ public void should_return_false_if_matching_multi_album_is_in_queue()
|
|||
.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 @@ public void should_return_false_if_multi_album_has_one_album_in_queue()
|
|||
.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 @@ public void should_return_false_if_multi_part_album_is_already_in_queue()
|
|||
.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 @@ public void should_return_false_if_multi_part_album_is_already_in_queue()
|
|||
}
|
||||
|
||||
[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)
|
||||
|
|
|
@ -84,6 +84,7 @@ public class HashedReleaseFixture : CoreTest
|
|||
};
|
||||
|
||||
[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);
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||
|
@ -14,11 +13,11 @@ public class QueueSpecification : IDecisionEngineSpecification
|
|||
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 @@ public Decision IsSatisfiedBy(RemoteAlbum subject, SearchCriteriaBase searchCrit
|
|||
|
||||
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 @@ public Decision IsSatisfiedBy(RemoteAlbum subject, SearchCriteriaBase searchCrit
|
|||
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 @@ public Decision IsSatisfiedBy(RemoteAlbum subject, SearchCriteriaBase searchCrit
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue