|
|
@ -66,6 +66,53 @@ namespace NzbDrone.Core.Test
|
|
|
|
Assert.IsTrue(result);
|
|
|
|
Assert.IsTrue(result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
public void AddByUrlNewzbin()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
const string sabHost = "192.168.5.55";
|
|
|
|
|
|
|
|
const int sabPort = 2222;
|
|
|
|
|
|
|
|
const string apikey = "5c770e3197e4fe763423ee7c392c25d1";
|
|
|
|
|
|
|
|
const string username = "admin";
|
|
|
|
|
|
|
|
const string password = "pass";
|
|
|
|
|
|
|
|
const SabnzbdPriorityType priority = SabnzbdPriorityType.Normal;
|
|
|
|
|
|
|
|
const string category = "tv";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var mocker = new AutoMoqer();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeConfig = mocker.GetMock<ConfigProvider>();
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.SabHost)
|
|
|
|
|
|
|
|
.Returns(sabHost);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.SabPort)
|
|
|
|
|
|
|
|
.Returns(sabPort);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.SabApiKey)
|
|
|
|
|
|
|
|
.Returns(apikey);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.SabUsername)
|
|
|
|
|
|
|
|
.Returns(username);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.SabPassword)
|
|
|
|
|
|
|
|
.Returns(password);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.SabTvPriority)
|
|
|
|
|
|
|
|
.Returns(priority);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.SabTvCategory)
|
|
|
|
|
|
|
|
.Returns(category);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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=This+is+an+Nzb&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"))
|
|
|
|
|
|
|
|
.Returns("ok");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
|
|
|
bool result = mocker.Resolve<SabProvider>().AddByUrl(
|
|
|
|
|
|
|
|
"http://www.newzbin.com/browse/post/6107863/nzb", "This is an Nzb");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
|
|
|
Assert.IsTrue(result);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void AddByUrlError()
|
|
|
|
public void AddByUrlError()
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -247,5 +294,49 @@ namespace NzbDrone.Core.Test
|
|
|
|
//Assert
|
|
|
|
//Assert
|
|
|
|
Assert.AreEqual(excpected, actual);
|
|
|
|
Assert.AreEqual(excpected, actual);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
[Explicit]
|
|
|
|
|
|
|
|
public void AddNewzbingByUrlSuccess()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
const string sabHost = "192.168.1.50";
|
|
|
|
|
|
|
|
const int sabPort = 8080;
|
|
|
|
|
|
|
|
const string apikey = "f37dc33baec2e5566f5aec666287870d";
|
|
|
|
|
|
|
|
const string username = "root";
|
|
|
|
|
|
|
|
const string password = "*************";
|
|
|
|
|
|
|
|
const SabnzbdPriorityType priority = SabnzbdPriorityType.Normal;
|
|
|
|
|
|
|
|
const string category = "tv";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var mocker = new AutoMoqer();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeConfig = mocker.GetMock<ConfigProvider>();
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.SabHost)
|
|
|
|
|
|
|
|
.Returns(sabHost);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.SabPort)
|
|
|
|
|
|
|
|
.Returns(sabPort);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.SabApiKey)
|
|
|
|
|
|
|
|
.Returns(apikey);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.SabUsername)
|
|
|
|
|
|
|
|
.Returns(username);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.SabPassword)
|
|
|
|
|
|
|
|
.Returns(password);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.SabTvPriority)
|
|
|
|
|
|
|
|
.Returns(priority);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.SabTvCategory)
|
|
|
|
|
|
|
|
.Returns(category);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mocker.SetConstant(new HttpProvider());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
|
|
|
bool result = mocker.Resolve<SabProvider>().AddByUrl(
|
|
|
|
|
|
|
|
"http://www.newzbin.com/browse/post/6107863/nzb", "This is an Nzb");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
|
|
|
Assert.IsTrue(result);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|