Sonarr/src/NzbDrone.Integration.Test/CommandIntegerationTests.cs

40 lines
1.2 KiB
C#
Raw Normal View History

using System.Net;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Api.Commands;
using NzbDrone.Common.Serializer;
using RestSharp;
namespace NzbDrone.Integration.Test
{
[TestFixture]
2016-04-02 02:19:32 +00:00
[Ignore("Command integration tests are bad, maybe?")]
public class CommandIntegrationTest : IntegrationTest
{
[Test]
public void should_be_able_to_run_rss_sync()
{
var request = new RestRequest("command")
{
RequestFormat = DataFormat.Json,
Method = Method.POST
};
2013-09-11 06:33:47 +00:00
request.AddBody(new CommandResource { Name = "rsssync" });
var restClient = new RestClient("http://localhost:8989/api");
var response = restClient.Execute(request);
if (response.ErrorException != null)
{
throw response.ErrorException;
}
2014-08-25 01:28:41 +00:00
response.ErrorMessage.Should().BeNullOrWhiteSpace();
response.StatusCode.Should().Be(HttpStatusCode.Created);
2013-09-11 06:33:47 +00:00
var trackedCommand = Json.Deserialize<CommandResource>(response.Content);
trackedCommand.Id.Should().NotBe(0);
}
}
}