mirror of
https://github.com/Readarr/Readarr.git
synced 2026-01-31 01:02:20 -05:00
more backend build fixes
This commit is contained in:
@@ -159,7 +159,6 @@ public void should_not_attempt_to_map_album_if_not_parsable()
|
||||
_pass1.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteBook>(), null), Times.Never());
|
||||
_pass2.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteBook>(), null), Times.Never());
|
||||
_pass3.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteBook>(), null), Times.Never());
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -185,16 +184,16 @@ public void should_return_rejected_result_for_unparsable_search()
|
||||
GivenSpecifications(_pass1, _pass2, _pass3);
|
||||
_reports[0].Title = "1937 - Snow White and the Seven Dwarves";
|
||||
|
||||
var artist = new Artist { Name = "Some Artist" };
|
||||
var albums = new List<Album> { new Album { Title = "Some Album" } };
|
||||
var author = new Author { Name = "Some Artist" };
|
||||
var books = new List<Book> { new Book { Title = "Some Album" } };
|
||||
|
||||
Subject.GetSearchDecision(_reports, new AlbumSearchCriteria { Artist = artist, Albums = albums }).ToList();
|
||||
Subject.GetSearchDecision(_reports, new BookSearchCriteria { Author = author, Books = books }).ToList();
|
||||
|
||||
Mocker.GetMock<IParsingService>().Verify(c => c.Map(It.IsAny<ParsedAlbumInfo>(), It.IsAny<SearchCriteriaBase>()), Times.Never());
|
||||
Mocker.GetMock<IParsingService>().Verify(c => c.Map(It.IsAny<ParsedBookInfo>(), It.IsAny<SearchCriteriaBase>()), Times.Never());
|
||||
|
||||
_pass1.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteAlbum>(), null), Times.Never());
|
||||
_pass2.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteAlbum>(), null), Times.Never());
|
||||
_pass3.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteAlbum>(), null), Times.Never());
|
||||
_pass1.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteBook>(), null), Times.Never());
|
||||
_pass2.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteBook>(), null), Times.Never());
|
||||
_pass3.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteBook>(), null), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -73,15 +73,15 @@ private void GivenPreferredDownloadProtocol(DownloadProtocol downloadProtocol)
|
||||
[Test]
|
||||
public void should_put_reals_before_non_reals()
|
||||
{
|
||||
var remoteAlbum1 = GivenRemoteAlbum(new List<Album> { GivenAlbum(1) }, new QualityModel(Quality.MP3_256, new Revision(version: 1, real: 0)));
|
||||
var remoteAlbum2 = GivenRemoteAlbum(new List<Album> { GivenAlbum(1) }, new QualityModel(Quality.MP3_256, new Revision(version: 1, real: 1)));
|
||||
var remoteAlbum1 = GivenRemoteAlbum(new List<Book> { GivenAlbum(1) }, new QualityModel(Quality.MP3_320, new Revision(version: 1, real: 0)));
|
||||
var remoteAlbum2 = GivenRemoteAlbum(new List<Book> { GivenAlbum(1) }, new QualityModel(Quality.MP3_320, new Revision(version: 1, real: 1)));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteAlbum1));
|
||||
decisions.Add(new DownloadDecision(remoteAlbum2));
|
||||
|
||||
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
||||
qualifiedReports.First().RemoteAlbum.ParsedAlbumInfo.Quality.Revision.Real.Should().Be(1);
|
||||
qualifiedReports.First().RemoteBook.ParsedBookInfo.Quality.Revision.Real.Should().Be(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -533,8 +533,8 @@ public void should_prefer_score_over_real_when_download_propers_is_do_not_prefer
|
||||
.Setup(s => s.DownloadPropersAndRepacks)
|
||||
.Returns(ProperDownloadTypes.DoNotPrefer);
|
||||
|
||||
var remoteAlbum1 = GivenRemoteAlbum(new List<Album> { GivenAlbum(1) }, new QualityModel(Quality.FLAC, new Revision(1, 0)));
|
||||
var remoteAlbum2 = GivenRemoteAlbum(new List<Album> { GivenAlbum(1) }, new QualityModel(Quality.FLAC, new Revision(1, 1)));
|
||||
var remoteAlbum1 = GivenRemoteAlbum(new List<Book> { GivenAlbum(1) }, new QualityModel(Quality.FLAC, new Revision(1, 0)));
|
||||
var remoteAlbum2 = GivenRemoteAlbum(new List<Book> { GivenAlbum(1) }, new QualityModel(Quality.FLAC, new Revision(1, 1)));
|
||||
|
||||
remoteAlbum1.PreferredWordScore = 10;
|
||||
remoteAlbum2.PreferredWordScore = 0;
|
||||
@@ -544,10 +544,10 @@ public void should_prefer_score_over_real_when_download_propers_is_do_not_prefer
|
||||
decisions.Add(new DownloadDecision(remoteAlbum2));
|
||||
|
||||
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
||||
qualifiedReports.First().RemoteAlbum.ParsedAlbumInfo.Quality.Quality.Should().Be(Quality.FLAC);
|
||||
qualifiedReports.First().RemoteAlbum.ParsedAlbumInfo.Quality.Revision.Version.Should().Be(1);
|
||||
qualifiedReports.First().RemoteAlbum.ParsedAlbumInfo.Quality.Revision.Real.Should().Be(0);
|
||||
qualifiedReports.First().RemoteAlbum.PreferredWordScore.Should().Be(10);
|
||||
qualifiedReports.First().RemoteBook.ParsedBookInfo.Quality.Quality.Should().Be(Quality.FLAC);
|
||||
qualifiedReports.First().RemoteBook.ParsedBookInfo.Quality.Revision.Version.Should().Be(1);
|
||||
qualifiedReports.First().RemoteBook.ParsedBookInfo.Quality.Revision.Real.Should().Be(0);
|
||||
qualifiedReports.First().RemoteBook.PreferredWordScore.Should().Be(10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ private void GivenExistingFile(QualityModel quality)
|
||||
private void GivenUpgradeForExistingFile()
|
||||
{
|
||||
Mocker.GetMock<IUpgradableSpecification>()
|
||||
.Setup(s => s.IsUpgradable(It.IsAny<QualityProfile>(), It.IsAny<List<QualityModel>>(), It.IsAny<int>(), It.IsAny<QualityModel>(), It.IsAny<int>()))
|
||||
.Setup(s => s.IsUpgradable(It.IsAny<QualityProfile>(), It.IsAny<QualityModel>(), It.IsAny<int>(), It.IsAny<QualityModel>(), It.IsAny<int>()))
|
||||
.Returns(true);
|
||||
}
|
||||
|
||||
@@ -185,17 +185,10 @@ public void should_be_true_when_release_is_a_real_for_existing_album()
|
||||
[Test]
|
||||
public void should_be_false_when_release_is_proper_for_existing_album_of_different_quality()
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
_remoteBook.ParsedBookInfo.Quality = new QualityModel(Quality.AZW3, new Revision(version: 2));
|
||||
_remoteBook.Release.PublishDate = DateTime.UtcNow;
|
||||
|
||||
GivenExistingFile(new QualityModel(Quality.PDF));
|
||||
=======
|
||||
_remoteAlbum.ParsedAlbumInfo.Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2));
|
||||
_remoteAlbum.Release.PublishDate = DateTime.UtcNow;
|
||||
|
||||
GivenExistingFile(new QualityModel(Quality.MP3_256));
|
||||
>>>>>>> Fixed: Delay profile being ignored for non-revision upgrades
|
||||
|
||||
_delayProfile.UsenetDelay = 720;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ public void should_return_false_when_quality_is_better_and_upgrade_allowed_is_fa
|
||||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||
UpgradeAllowed = false
|
||||
},
|
||||
new List<QualityModel> { new QualityModel(Quality.MP3_320) },
|
||||
new QualityModel(Quality.MP3_320),
|
||||
new QualityModel(Quality.FLAC))
|
||||
.Should().BeFalse();
|
||||
}
|
||||
@@ -36,7 +36,7 @@ public void should_return_true_for_quality_upgrade_when_upgrading_is_allowed()
|
||||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||
UpgradeAllowed = true
|
||||
},
|
||||
new List<QualityModel> { new QualityModel(Quality.MP3_320) },
|
||||
new QualityModel(Quality.MP3_320),
|
||||
new QualityModel(Quality.FLAC))
|
||||
.Should().BeTrue();
|
||||
}
|
||||
@@ -51,7 +51,7 @@ public void should_return_true_for_same_quality_when_upgrading_is_allowed()
|
||||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||
UpgradeAllowed = true
|
||||
},
|
||||
new List<QualityModel> { new QualityModel(Quality.MP3_320) },
|
||||
new QualityModel(Quality.MP3_320),
|
||||
new QualityModel(Quality.MP3_320))
|
||||
.Should().BeTrue();
|
||||
}
|
||||
@@ -66,7 +66,7 @@ public void should_return_true_for_same_quality_when_upgrading_is_not_allowed()
|
||||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||
UpgradeAllowed = false
|
||||
},
|
||||
new List<QualityModel> { new QualityModel(Quality.MP3_320) },
|
||||
new QualityModel(Quality.MP3_320),
|
||||
new QualityModel(Quality.MP3_320))
|
||||
.Should().BeTrue();
|
||||
}
|
||||
@@ -81,7 +81,7 @@ public void should_return_true_for_lower_quality_when_upgrading_is_allowed()
|
||||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||
UpgradeAllowed = true
|
||||
},
|
||||
new List<QualityModel> { new QualityModel(Quality.MP3_320) },
|
||||
new QualityModel(Quality.MP3_320),
|
||||
new QualityModel(Quality.MP3_320))
|
||||
.Should().BeTrue();
|
||||
}
|
||||
@@ -96,7 +96,7 @@ public void should_return_true_for_lower_quality_when_upgrading_is_not_allowed()
|
||||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||
UpgradeAllowed = false
|
||||
},
|
||||
new List<QualityModel> { new QualityModel(Quality.MP3_320) },
|
||||
new QualityModel(Quality.MP3_320),
|
||||
new QualityModel(Quality.MP3_320))
|
||||
.Should().BeTrue();
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public void IsUpgradeTest(Quality current, int currentVersion, Quality newQualit
|
||||
|
||||
Subject.IsUpgradable(
|
||||
profile,
|
||||
new List<QualityModel> { new QualityModel(current, new Revision(version: currentVersion)) },
|
||||
new QualityModel(current, new Revision(version: currentVersion)),
|
||||
NoPreferredWordScore,
|
||||
new QualityModel(newQuality, new Revision(version: newVersion)),
|
||||
NoPreferredWordScore)
|
||||
@@ -65,7 +65,7 @@ public void should_return_true_if_proper_and_download_propers_is_do_not_download
|
||||
|
||||
Subject.IsUpgradable(
|
||||
profile,
|
||||
new List<QualityModel> { new QualityModel(Quality.MP3_320, new Revision(version: 1)) },
|
||||
new QualityModel(Quality.MP3_320, new Revision(version: 1)),
|
||||
NoPreferredWordScore,
|
||||
new QualityModel(Quality.MP3_320, new Revision(version: 2)),
|
||||
NoPreferredWordScore)
|
||||
@@ -84,7 +84,7 @@ public void should_return_false_if_proper_and_autoDownloadPropers_is_do_not_pref
|
||||
|
||||
Subject.IsUpgradable(
|
||||
profile,
|
||||
new List<QualityModel> { new QualityModel(Quality.MP3_320, new Revision(version: 1)) },
|
||||
new QualityModel(Quality.MP3_320, new Revision(version: 1)),
|
||||
NoPreferredWordScore,
|
||||
new QualityModel(Quality.MP3_320, new Revision(version: 2)),
|
||||
NoPreferredWordScore)
|
||||
|
||||
@@ -20,12 +20,12 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||
public class DeleteBadMediaCoversFixture : CoreTest<DeleteBadMediaCovers>
|
||||
{
|
||||
private List<MetadataFile> _metadata;
|
||||
private List<Author> _artist;
|
||||
private List<Author> _author;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_artist = Builder<Author>.CreateListOfSize(1)
|
||||
_author = Builder<Author>.CreateListOfSize(1)
|
||||
.All()
|
||||
.With(c => c.Path = "C:\\Music\\".AsOsAgnostic())
|
||||
.Build().ToList();
|
||||
@@ -33,12 +33,12 @@ public void Setup()
|
||||
_metadata = Builder<MetadataFile>.CreateListOfSize(1)
|
||||
.Build().ToList();
|
||||
|
||||
Mocker.GetMock<IArtistService>()
|
||||
.Setup(c => c.AllArtistPaths())
|
||||
.Returns(_artist.ToDictionary(x => x.Id, x => x.Path));
|
||||
Mocker.GetMock<IAuthorService>()
|
||||
.Setup(c => c.AllAuthorPaths())
|
||||
.Returns(_author.ToDictionary(x => x.Id, x => x.Path));
|
||||
|
||||
Mocker.GetMock<IMetadataFileService>()
|
||||
.Setup(c => c.GetFilesByAuthor(_artist.First().Id))
|
||||
.Setup(c => c.GetFilesByAuthor(_author.First().Id))
|
||||
.Returns(_metadata);
|
||||
|
||||
Mocker.GetMock<IConfigService>().SetupGet(c => c.CleanupMetadataImages).Returns(true);
|
||||
@@ -73,7 +73,7 @@ public void should_not_run_if_flag_is_false()
|
||||
Subject.Clean();
|
||||
|
||||
Mocker.GetMock<IConfigService>().VerifySet(c => c.CleanupMetadataImages = true, Times.Never());
|
||||
Mocker.GetMock<IArtistService>().Verify(c => c.GetAllAuthors(), Times.Never());
|
||||
Mocker.GetMock<IAuthorService>().Verify(c => c.GetAllAuthors(), Times.Never());
|
||||
|
||||
AssertImageWasNotRemoved();
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ private void GivenMissingRootFolder()
|
||||
.Build()
|
||||
.ToList();
|
||||
|
||||
Mocker.GetMock<IArtistService>()
|
||||
.Setup(s => s.AllArtistPaths())
|
||||
Mocker.GetMock<IAuthorService>()
|
||||
.Setup(s => s.AllAuthorPaths())
|
||||
.Returns(artist.ToDictionary(x => x.Id, x => x.Path));
|
||||
|
||||
Mocker.GetMock<IImportListFactory>()
|
||||
@@ -44,8 +44,8 @@ private void GivenMissingRootFolder()
|
||||
[Test]
|
||||
public void should_not_return_error_when_no_artist()
|
||||
{
|
||||
Mocker.GetMock<IArtistService>()
|
||||
.Setup(s => s.AllArtistPaths())
|
||||
Mocker.GetMock<IAuthorService>()
|
||||
.Setup(s => s.AllAuthorPaths())
|
||||
.Returns(new Dictionary<int, string>());
|
||||
|
||||
Mocker.GetMock<IImportListFactory>()
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.BookImport;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
@@ -95,12 +96,18 @@ public void should_be_reject_if_file_size_is_the_same()
|
||||
[Test]
|
||||
public void should_be_accepted_if_file_cannot_be_fetched()
|
||||
{
|
||||
_localTrack.Tracks = Builder<Track>.CreateListOfSize(1)
|
||||
_localTrack.Book = (Book)Builder<Book>.CreateListOfSize(1)
|
||||
.TheFirst(1)
|
||||
.With(e => e.TrackFileId = 1)
|
||||
.With(e => e.TrackFile = new LazyLoaded<TrackFile>((TrackFile)null))
|
||||
.Build()
|
||||
.ToList();
|
||||
.With(e => e.Id = 1)
|
||||
.With(e => e.BookFiles = new LazyLoaded<List<BookFile>>(
|
||||
new List<BookFile>
|
||||
{
|
||||
new BookFile
|
||||
{
|
||||
Path = null
|
||||
}
|
||||
}))
|
||||
.Build();
|
||||
|
||||
Subject.IsSatisfiedBy(_localTrack, null).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
||||
57
src/NzbDrone.Core/HealthCheck/Checks/MonoNotNetCoreCheck.cs
Normal file
57
src/NzbDrone.Core/HealthCheck/Checks/MonoNotNetCoreCheck.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using NLog;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Common.Processes;
|
||||
|
||||
namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
public class MonoNotNetCoreCheck : HealthCheckBase
|
||||
{
|
||||
private static string[] MonoUnames = new string[] { "FreeBSD", "OpenBSD", "MidnightBSD", "NetBSD" };
|
||||
private readonly IOsInfo _osInfo;
|
||||
private readonly IProcessProvider _processProvider;
|
||||
|
||||
public MonoNotNetCoreCheck(IOsInfo osInfo,
|
||||
IProcessProvider processProvider,
|
||||
Logger logger)
|
||||
{
|
||||
_osInfo = osInfo;
|
||||
_processProvider = processProvider;
|
||||
}
|
||||
|
||||
public override HealthCheck Check()
|
||||
{
|
||||
if (!PlatformInfo.IsMono)
|
||||
{
|
||||
return new HealthCheck(GetType());
|
||||
}
|
||||
|
||||
// Don't warn on arm based synology - could be arm5 or something else rubbish
|
||||
if (_osInfo.Name == "DSM" && RuntimeInformation.ProcessArchitecture == Architecture.Arm)
|
||||
{
|
||||
return new HealthCheck(GetType());
|
||||
}
|
||||
|
||||
// Don't warn on linux x86 - we don't build x86 net core
|
||||
if (OsInfo.IsLinux && RuntimeInformation.ProcessArchitecture == Architecture.X86)
|
||||
{
|
||||
return new HealthCheck(GetType());
|
||||
}
|
||||
|
||||
// Check for BSD
|
||||
var output = _processProvider.StartAndCapture("uname");
|
||||
if (output?.ExitCode == 0 && MonoUnames.Contains(output?.Lines.First().Content))
|
||||
{
|
||||
return new HealthCheck(GetType());
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Warning,
|
||||
"Please upgrade to the .NET Core version of Lidarr",
|
||||
"#update-to-net-core-version");
|
||||
}
|
||||
|
||||
public override bool CheckOnSchedule => false;
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ protected override bool IsValid(PropertyValidatorContext context)
|
||||
return true;
|
||||
}
|
||||
|
||||
return !_authorService.GetAllAuthors().Any(s => context.PropertyValue.ToString().IsParentPath(s.Value));
|
||||
return !_authorService.AllAuthorPaths().Any(s => context.PropertyValue.ToString().IsParentPath(s.Value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using Lidarr.Api.V1.Indexers;
|
||||
using Lidarr.Http.ClientSchema;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
using Readarr.Api.V1.Indexers;
|
||||
using Readarr.Http.ClientSchema;
|
||||
|
||||
namespace NzbDrone.Integration.Test.ApiTests
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using NzbDrone.Core.Blacklisting;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using Readarr.Http;
|
||||
using Readarr.Http.Extensions;
|
||||
|
||||
namespace Readarr.Api.V1.Blacklist
|
||||
{
|
||||
@@ -31,9 +32,9 @@ private void DeleteBlacklist(int id)
|
||||
|
||||
private object Remove()
|
||||
{
|
||||
var resource = Request.Body.FromJson<BlacklistBulkResource>();
|
||||
var resource = Request.Body.FromJson<BlacklistResource>();
|
||||
|
||||
_blacklistService.Delete(resource.Ids);
|
||||
_blacklistService.Delete(resource.Id);
|
||||
|
||||
return new object();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user