mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
New: NzbDrone service to automatically report errors and episode parse issues.
This commit is contained in:
parent
ea86ce2fcb
commit
174f765ec9
140 changed files with 10774 additions and 1694 deletions
|
@ -0,0 +1,68 @@
|
|||
using System.Linq;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Contract;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Common.Test
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
public class ReportingService_ReportParseError_Fixture : TestBase
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
ReportingService.ClearCache();
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
ReportingService.ClearCache();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void report_parse_error_should_send_report_to_server()
|
||||
{
|
||||
const string badTitle = "Bad Title";
|
||||
|
||||
ReportingService.ReportParseError(badTitle);
|
||||
MockedRestProvider.Verify(p => p.PostData(It.IsAny<string>(), It.Is<ParseErrorReport>(c => c.Title == badTitle)), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void report_parse_error_should_send_duplicated_report_once()
|
||||
{
|
||||
const string badTitle = "Bad Title";
|
||||
|
||||
ReportingService.ReportParseError(badTitle);
|
||||
ReportingService.ReportParseError(badTitle);
|
||||
|
||||
MockedRestProvider.Verify(p => p.PostData(It.IsAny<string>(), It.IsAny<ReportBase>()), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void report_parse_error_should_send_duplicated_report_once_with_diffrent_casing()
|
||||
{
|
||||
const string badTitle = "Bad Title";
|
||||
|
||||
ReportingService.ReportParseError(badTitle.ToUpper());
|
||||
ReportingService.ReportParseError(badTitle);
|
||||
|
||||
MockedRestProvider.Verify(p => p.PostData(It.IsAny<string>(), It.IsAny<ReportBase>()), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void report_parse_error_should_send_multiple_reports_if_titles_are_diffrent()
|
||||
{
|
||||
ReportingService.ReportParseError("title 1");
|
||||
ReportingService.ReportParseError("title 2");
|
||||
|
||||
MockedRestProvider.Verify(p => p.PostData(It.IsAny<string>(), It.IsAny<ReportBase>()), Times.Exactly(2));
|
||||
MockedRestProvider.Verify(p => p.PostData(It.IsAny<string>(), It.Is<ParseErrorReport>(c => c.Title == "title 1")), Times.Once());
|
||||
MockedRestProvider.Verify(p => p.PostData(It.IsAny<string>(), It.Is<ParseErrorReport>(c => c.Title == "title 2")), Times.Once());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue