Sonarr Pulls

'e4c341898
'5613ab05e
'372442af2
'28c45f941
'ea1616586
This commit is contained in:
Qstick
2017-09-25 22:31:52 -04:00
parent 482f8c1a61
commit ab9a9232cf
41 changed files with 247 additions and 179 deletions
@@ -1,5 +1,6 @@
using System;
using System;
using System.Linq;
using System.Net;
using FluentAssertions;
using Moq;
using NUnit.Framework;
@@ -7,6 +8,7 @@ using NzbDrone.Common.Http;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Indexers.Newznab;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
{
@@ -69,5 +71,27 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
Subject.PageSize.Should().Be(25);
}
}
[Test]
public void should_record_indexer_failure_if_caps_throw()
{
var request = new HttpRequest("http://my.indexer.com");
var response = new HttpResponse(request, new HttpHeader(), new byte[0], (HttpStatusCode)429);
response.Headers["Retry-After"] = "300";
Mocker.GetMock<INewznabCapabilitiesProvider>()
.Setup(v => v.GetCapabilities(It.IsAny<NewznabSettings>()))
.Throws(new TooManyRequestsException(request, response));
_caps.MaxPageSize = 30;
_caps.DefaultPageSize = 25;
Subject.FetchRecent().Should().BeEmpty();
Mocker.GetMock<IIndexerStatusService>()
.Verify(v => v.RecordFailure(It.IsAny<int>(), TimeSpan.FromMinutes(5.0)), Times.Once());
ExceptionVerification.ExpectedWarns(1);
}
}
}