2013-08-31 06:19:19 +00:00
|
|
|
|
using System.Net;
|
|
|
|
|
using FluentAssertions;
|
|
|
|
|
using NUnit.Framework;
|
2013-04-27 02:03:34 +00:00
|
|
|
|
using NzbDrone.Api.Commands;
|
2013-08-31 06:19:19 +00:00
|
|
|
|
using NzbDrone.Common.Messaging.Tracking;
|
|
|
|
|
using NzbDrone.Common.Serializer;
|
|
|
|
|
using RestSharp;
|
2013-04-27 02:03:34 +00:00
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Integration.Test
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
2013-09-10 05:39:18 +00:00
|
|
|
|
[Ignore]
|
2013-04-27 02:03:34 +00:00
|
|
|
|
public class CommandIntegrationTest : IntegrationTest
|
|
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_be_able_to_run_rss_sync()
|
|
|
|
|
{
|
2013-08-31 06:19:19 +00:00
|
|
|
|
var request = new RestRequest("command")
|
|
|
|
|
{
|
|
|
|
|
RequestFormat = DataFormat.Json,
|
|
|
|
|
Method = Method.POST
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
request.AddBody(new CommandResource {Command = "rsssync"});
|
|
|
|
|
|
|
|
|
|
var restClient = new RestClient("http://localhost:8989/api");
|
|
|
|
|
var response = restClient.Execute(request);
|
|
|
|
|
|
|
|
|
|
if (response.ErrorException != null)
|
|
|
|
|
{
|
|
|
|
|
throw response.ErrorException;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
response.ErrorMessage.Should().BeBlank();
|
|
|
|
|
response.StatusCode.Should().Be(HttpStatusCode.Created);
|
|
|
|
|
|
|
|
|
|
var trackedCommand = Json.Deserialize<TrackedCommand>(response.Content);
|
|
|
|
|
trackedCommand.Id.Should().NotBeNullOrEmpty();
|
2013-04-27 02:03:34 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|