2013-08-14 07:02:25 +02:00
|
|
|
|
using NLog;
|
|
|
|
|
using NLog.Config;
|
|
|
|
|
using NLog.Targets;
|
2013-04-22 05:18:08 +02:00
|
|
|
|
using NUnit.Framework;
|
2013-04-27 04:03:34 +02:00
|
|
|
|
using NzbDrone.Api.Commands;
|
2013-08-28 02:16:24 +02:00
|
|
|
|
using NzbDrone.Api.Config;
|
2013-04-22 05:18:08 +02:00
|
|
|
|
using NzbDrone.Api.RootFolders;
|
2013-06-28 02:04:52 +02:00
|
|
|
|
using NzbDrone.Common.EnvironmentInfo;
|
2013-04-22 05:18:08 +02:00
|
|
|
|
using NzbDrone.Integration.Test.Client;
|
2013-05-22 07:32:25 +02:00
|
|
|
|
using NzbDrone.Test.Common.Categories;
|
2013-04-22 05:18:08 +02:00
|
|
|
|
using RestSharp;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Integration.Test
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
2013-05-22 07:32:25 +02:00
|
|
|
|
[IntegrationTest]
|
2013-04-22 05:18:08 +02:00
|
|
|
|
public abstract class IntegrationTest
|
|
|
|
|
{
|
|
|
|
|
protected RestClient RestClient { get; private set; }
|
|
|
|
|
|
|
|
|
|
protected SeriesClient Series;
|
|
|
|
|
protected ClientBase<RootFolderResource> RootFolders;
|
2013-04-27 04:03:34 +02:00
|
|
|
|
protected ClientBase<CommandResource> Commands;
|
2013-04-28 21:46:13 +02:00
|
|
|
|
protected ReleaseClient Releases;
|
2013-05-03 07:24:52 +02:00
|
|
|
|
protected IndexerClient Indexers;
|
2013-08-27 05:20:03 +02:00
|
|
|
|
protected EpisodeClient Episodes;
|
|
|
|
|
protected SeasonClient Seasons;
|
2013-08-28 02:16:24 +02:00
|
|
|
|
protected ClientBase<NamingConfigResource> NamingConfig;
|
2013-04-22 05:18:08 +02:00
|
|
|
|
|
2013-08-14 05:22:28 +02:00
|
|
|
|
private NzbDroneRunner _runner;
|
|
|
|
|
|
2013-08-14 07:02:25 +02:00
|
|
|
|
public IntegrationTest()
|
|
|
|
|
{
|
|
|
|
|
new StartupArguments();
|
|
|
|
|
|
|
|
|
|
LogManager.Configuration = new LoggingConfiguration();
|
|
|
|
|
var consoleTarget = new ConsoleTarget { Layout = "${level}: ${message} ${exception}" };
|
|
|
|
|
LogManager.Configuration.AddTarget(consoleTarget.GetType().Name, consoleTarget);
|
|
|
|
|
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, consoleTarget));
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-13 07:08:37 +02:00
|
|
|
|
[SetUp]
|
|
|
|
|
public void SmokeTestSetup()
|
2013-04-22 05:18:08 +02:00
|
|
|
|
{
|
2013-08-14 05:22:28 +02:00
|
|
|
|
_runner = new NzbDroneRunner();
|
|
|
|
|
_runner.KillAll();
|
2013-04-22 05:18:08 +02:00
|
|
|
|
|
2013-08-13 07:08:37 +02:00
|
|
|
|
InitRestClients();
|
|
|
|
|
|
2013-08-14 05:22:28 +02:00
|
|
|
|
_runner.Start();
|
2013-08-13 07:08:37 +02:00
|
|
|
|
}
|
2013-04-22 05:18:08 +02:00
|
|
|
|
|
2013-06-28 02:04:52 +02:00
|
|
|
|
private void InitRestClients()
|
|
|
|
|
{
|
2013-08-13 07:08:37 +02:00
|
|
|
|
RestClient = new RestClient("http://localhost:8989/api");
|
2013-04-22 05:18:08 +02:00
|
|
|
|
Series = new SeriesClient(RestClient);
|
2013-04-28 21:46:13 +02:00
|
|
|
|
Releases = new ReleaseClient(RestClient);
|
2013-04-22 05:18:08 +02:00
|
|
|
|
RootFolders = new ClientBase<RootFolderResource>(RestClient);
|
2013-04-27 04:03:34 +02:00
|
|
|
|
Commands = new ClientBase<CommandResource>(RestClient);
|
2013-05-03 07:24:52 +02:00
|
|
|
|
Indexers = new IndexerClient(RestClient);
|
2013-08-27 05:20:03 +02:00
|
|
|
|
Episodes = new EpisodeClient(RestClient);
|
|
|
|
|
Seasons = new SeasonClient(RestClient);
|
2013-08-28 02:16:24 +02:00
|
|
|
|
NamingConfig = new ClientBase<NamingConfigResource>(RestClient, "config/naming");
|
2013-04-22 05:18:08 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TearDown]
|
|
|
|
|
public void SmokeTestTearDown()
|
|
|
|
|
{
|
2013-08-14 05:22:28 +02:00
|
|
|
|
_runner.KillAll();
|
2013-04-22 05:18:08 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2013-04-27 04:03:34 +02:00
|
|
|
|
|
2013-04-22 05:18:08 +02:00
|
|
|
|
}
|