New: UI Updates, Tag manager, More custom filters (#437)

* New: UI Updates, Tag manager, More custom filters

* fixup! Fix ScanFixture Unit Tests

* Fixed: Sentry Errors from UI don't have release, branch, environment

* Changed: Bump Mobile Detect for New Device Detection

* Fixed: Build on changes to package.json

* fixup! Add MetadataProfile filter option

* fixup! Tag Note, Blacklist, Manual Import

* fixup: Remove connectSection

* fixup: root folder comment
This commit is contained in:
Qstick
2018-08-07 20:57:15 -04:00
committed by GitHub
parent afa78b1d20
commit 6581b3a2c5
198 changed files with 3057 additions and 888 deletions
@@ -10,6 +10,7 @@ using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.MediaFiles.TrackImport;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Core.Music;
using NzbDrone.Core.RootFolders;
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.MediaFiles.DiskScanServiceTests
@@ -39,6 +40,10 @@ namespace NzbDrone.Core.Test.MediaFiles.DiskScanServiceTests
Mocker.GetMock<IDiskProvider>()
.Setup(s => s.GetParentFolder(It.IsAny<string>()))
.Returns((string path) => Directory.GetParent(path).FullName);
Mocker.GetMock<IRootFolderService>()
.Setup(s => s.GetBestRootFolderPath(It.IsAny<string>()))
.Returns(_rootFolder);
}
private void GivenRootFolder(params string[] subfolders)
@@ -1,9 +1,11 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using FizzWare.NBuilder;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Core.RootFolders;
using NzbDrone.Core.Music;
using NzbDrone.Core.Organizer;
using NzbDrone.Core.Test.Framework;
@@ -31,7 +33,7 @@ namespace NzbDrone.Core.Test.MusicTests.ArtistServiceTests
[Test]
public void should_call_repo_updateMany()
{
Subject.UpdateArtists(_artists);
Subject.UpdateArtists(_artists, false);
Mocker.GetMock<IArtistRepository>().Verify(v => v.UpdateMany(_artists), Times.Once());
}
@@ -46,13 +48,18 @@ namespace NzbDrone.Core.Test.MusicTests.ArtistServiceTests
var newRoot = @"C:\Test\Music2".AsOsAgnostic();
_artists.ForEach(s => s.RootFolderPath = newRoot);
Subject.UpdateArtists(_artists).ForEach(s => s.Path.Should().StartWith(newRoot));
Mocker.GetMock<IBuildArtistPaths>()
.Setup(s => s.BuildPath(It.IsAny<Artist>(), false))
.Returns<Artist, bool>((s, u) => Path.Combine(s.RootFolderPath, s.Name));
Subject.UpdateArtists(_artists, false).ForEach(s => s.Path.Should().StartWith(newRoot));
}
[Test]
public void should_not_update_path_when_rootFolderPath_is_empty()
{
Subject.UpdateArtists(_artists).ForEach(s =>
Subject.UpdateArtists(_artists, false).ForEach(s =>
{
var expectedPath = _artists.Single(ser => ser.Id == s.Id).Path;
s.Path.Should().Be(expectedPath);
@@ -75,7 +82,7 @@ namespace NzbDrone.Core.Test.MusicTests.ArtistServiceTests
var newRoot = @"C:\Test\Music2".AsOsAgnostic();
artist.ForEach(s => s.RootFolderPath = newRoot);
Subject.UpdateArtists(artist);
Subject.UpdateArtists(artist, false);
}
}
}
@@ -29,10 +29,10 @@ namespace NzbDrone.Core.Test.MusicTests
_command = new MoveArtistCommand
{
ArtistId = 1,
SourcePath = @"C:\Test\Music\Artist".AsOsAgnostic(),
DestinationPath = @"C:\Test\Music2\Artist".AsOsAgnostic()
};
ArtistId = 1,
SourcePath = @"C:\Test\Music\Artist".AsOsAgnostic(),
DestinationPath = @"C:\Test\Music2\Artist".AsOsAgnostic()
};
_bulkCommand = new BulkMoveArtistCommand
{
@@ -48,15 +48,19 @@ namespace NzbDrone.Core.Test.MusicTests
};
Mocker.GetMock<IArtistService>()
.Setup(s => s.GetArtist(It.IsAny<int>()))
.Returns(_artist);
.Setup(s => s.GetArtist(It.IsAny<int>()))
.Returns(_artist);
Mocker.GetMock<IDiskProvider>()
.Setup(s => s.FolderExists(It.IsAny<string>()))
.Returns(true);
}
private void GivenFailedMove()
{
Mocker.GetMock<IDiskTransferService>()
.Setup(s => s.TransferFolder(It.IsAny<string>(), It.IsAny<string>(), TransferMode.Move, true))
.Throws<IOException>();
.Setup(s => s.TransferFolder(It.IsAny<string>(), It.IsAny<string>(), TransferMode.Move, true))
.Throws<IOException>();
}
[Test]
@@ -89,7 +93,9 @@ namespace NzbDrone.Core.Test.MusicTests
Subject.Execute(_command);
Mocker.GetMock<IDiskTransferService>()
.Verify(v => v.TransferFolder(_command.SourcePath, _command.DestinationPath, TransferMode.Move, It.IsAny<bool>()), Times.Once());
.Verify(
v => v.TransferFolder(_command.SourcePath, _command.DestinationPath, TransferMode.Move,
It.IsAny<bool>()), Times.Once());
Mocker.GetMock<IBuildFileNames>()
.Verify(v => v.GetArtistFolder(It.IsAny<Artist>(), null), Times.Never());
@@ -109,7 +115,29 @@ namespace NzbDrone.Core.Test.MusicTests
Subject.Execute(_bulkCommand);
Mocker.GetMock<IDiskTransferService>()
.Verify(v => v.TransferFolder(_bulkCommand.Artist.First().SourcePath, expectedPath, TransferMode.Move, It.IsAny<bool>()), Times.Once());
.Verify(
v => v.TransferFolder(_bulkCommand.Artist.First().SourcePath, expectedPath, TransferMode.Move,
It.IsAny<bool>()), Times.Once());
}
[Test]
public void should_skip_artist_folder_if_it_does_not_exist()
{
Mocker.GetMock<IDiskProvider>()
.Setup(s => s.FolderExists(It.IsAny<string>()))
.Returns(false);
Subject.Execute(_command);
Mocker.GetMock<IDiskTransferService>()
.Verify(
v => v.TransferFolder(_command.SourcePath, _command.DestinationPath, TransferMode.Move,
It.IsAny<bool>()), Times.Never());
Mocker.GetMock<IBuildFileNames>()
.Verify(v => v.GetArtistFolder(It.IsAny<Artist>(), null), Times.Never());
}
}
}