New: Health Check Failure Notifications (#609)

* New: Health Check Failure Notifications

Fixes #295

* New: OnDownloadFailure and OnImportFailure Notification

* New: On Retag notifications

* Fixed: XBMC notification test

* New: Discord Notifications

Closes #1511

* On Download to On Import on card

* Remove OnDownload, Rename OnAlbumDownload -> OnReleaseImported

* Fixed: Webhook OnReleaseImport notification

* Respect OnUpgrade and fix missing schema items for frontend

* New: Simplify Notification Modal UI

* Fixed: PlexHomeTheater OnReleaseImport notification
This commit is contained in:
Qstick
2019-03-21 20:47:54 -04:00
committed by GitHub
parent 4d8bcd12e3
commit d4d9146599
52 changed files with 1262 additions and 427 deletions
@@ -0,0 +1,71 @@
using System.Collections.Generic;
using System.Linq;
using FizzWare.NBuilder;
using Moq;
using NUnit.Framework;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Notifications;
using NzbDrone.Core.Notifications.Xbmc;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Core.Music;
namespace NzbDrone.Core.Test.NotificationTests.Xbmc
{
[TestFixture]
public class OnReleaseImportFixture : CoreTest<Notifications.Xbmc.Xbmc>
{
private AlbumDownloadMessage _albumDownloadMessage;
[SetUp]
public void Setup()
{
var artist = Builder<Artist>.CreateNew()
.Build();
var trackFile = Builder<TrackFile>.CreateNew()
.Build();
_albumDownloadMessage = Builder<AlbumDownloadMessage>.CreateNew()
.With(d => d.Artist = artist)
.With(d => d.TrackFiles = new List<TrackFile> { trackFile })
.With(d => d.OldFiles = new List<TrackFile>())
.Build();
Subject.Definition = new NotificationDefinition();
Subject.Definition.Settings = new XbmcSettings
{
UpdateLibrary = true
};
}
private void GivenOldFiles()
{
_albumDownloadMessage.OldFiles = Builder<TrackFile>.CreateListOfSize(1)
.Build()
.ToList();
Subject.Definition.Settings = new XbmcSettings
{
UpdateLibrary = true,
CleanLibrary = true
};
}
[Test]
public void should_not_clean_if_no_episode_was_replaced()
{
Subject.OnReleaseImport(_albumDownloadMessage);
Mocker.GetMock<IXbmcService>().Verify(v => v.Clean(It.IsAny<XbmcSettings>()), Times.Never());
}
[Test]
public void should_clean_if_episode_was_replaced()
{
GivenOldFiles();
Subject.OnReleaseImport(_albumDownloadMessage);
Mocker.GetMock<IXbmcService>().Verify(v => v.Clean(It.IsAny<XbmcSettings>()), Times.Once());
}
}
}