|
|
@ -43,15 +43,15 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
|
|
|
private void WithFailResponse()
|
|
|
|
private void WithFailResponse()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Mocker.GetMock<HttpProvider>()
|
|
|
|
Mocker.GetMock<HttpProvider>()
|
|
|
|
.Setup(s => s.DownloadString(It.IsAny<String>())).Returns("failed");
|
|
|
|
.Setup(s => s.DownloadString(It.IsAny<String>())).Returns("{ \"status\": false, \"error\": \"API Key Required\" }");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void add_url_should_format_request_properly()
|
|
|
|
public void add_url_should_format_request_properly()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Mocker.GetMock<HttpProvider>(MockBehavior.Strict)
|
|
|
|
Mocker.GetMock<HttpProvider>(MockBehavior.Strict)
|
|
|
|
.Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=0&pp=3&cat=tv&nzbname=My+Series+Name+-+5x2-5x3+-+My+title+%5bBluray720p%5d+%5bProper%5d&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"))
|
|
|
|
.Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=0&pp=3&cat=tv&nzbname=My+Series+Name+-+5x2-5x3+-+My+title+%5bBluray720p%5d+%5bProper%5d&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"))
|
|
|
|
.Returns("ok");
|
|
|
|
.Returns("{ \"status\": true }");
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
//Act
|
|
|
|
Mocker.Resolve<SabProvider>().DownloadNzb(url, title).Should().BeTrue();
|
|
|
|
Mocker.Resolve<SabProvider>().DownloadNzb(url, title).Should().BeTrue();
|
|
|
@ -61,8 +61,8 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
|
|
|
public void newzbin_add_url_should_format_request_properly()
|
|
|
|
public void newzbin_add_url_should_format_request_properly()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Mocker.GetMock<HttpProvider>(MockBehavior.Strict)
|
|
|
|
Mocker.GetMock<HttpProvider>(MockBehavior.Strict)
|
|
|
|
.Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=addid&name=6107863&priority=0&pp=3&cat=tv&nzbname=My+Series+Name+-+5x2-5x3+-+My+title+%5bBluray720p%5d+%5bProper%5d&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"))
|
|
|
|
.Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=addid&name=6107863&priority=0&pp=3&cat=tv&nzbname=My+Series+Name+-+5x2-5x3+-+My+title+%5bBluray720p%5d+%5bProper%5d&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"))
|
|
|
|
.Returns("ok");
|
|
|
|
.Returns("{ \"status\": true }");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
//Act
|
|
|
@ -78,8 +78,8 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
|
|
|
WithFailResponse();
|
|
|
|
WithFailResponse();
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
//Act
|
|
|
|
Mocker.Resolve<SabProvider>().DownloadNzb(url, title).Should().BeFalse();
|
|
|
|
Assert.Throws<ApplicationException>(() => Mocker.Resolve<SabProvider>().DownloadNzb(url, title).Should().BeFalse());
|
|
|
|
ExceptionVerification.ExpectedWarns(1);
|
|
|
|
//ExceptionVerification.ExpectedErrors(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|