mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-25 22:36:59 -04:00
@@ -31,7 +31,6 @@ namespace NzbDrone.Integration.Test.Client
|
||||
var request = BuildRequest(slug);
|
||||
return Get<ArtistResource>(request, statusCode);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class SystemInfoClient : ClientBase<ArtistResource>
|
||||
|
||||
@@ -60,7 +60,8 @@ namespace NzbDrone.Integration.Test.Client
|
||||
return response.Content;
|
||||
}
|
||||
|
||||
public T Execute<T>(IRestRequest request, HttpStatusCode statusCode) where T : class, new()
|
||||
public T Execute<T>(IRestRequest request, HttpStatusCode statusCode)
|
||||
where T : class, new()
|
||||
{
|
||||
var content = Execute(request, statusCode);
|
||||
|
||||
@@ -83,7 +84,6 @@ namespace NzbDrone.Integration.Test.Client
|
||||
public ClientBase(IRestClient restClient, string apiKey, string resource = null)
|
||||
: base(restClient, apiKey, resource ?? new TResource().ResourceName)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public List<TResource> All()
|
||||
@@ -161,19 +161,22 @@ namespace NzbDrone.Integration.Test.Client
|
||||
return Put<object>(request, statusCode);
|
||||
}
|
||||
|
||||
public T Get<T>(IRestRequest request, HttpStatusCode statusCode = HttpStatusCode.OK) where T : class, new()
|
||||
public T Get<T>(IRestRequest request, HttpStatusCode statusCode = HttpStatusCode.OK)
|
||||
where T : class, new()
|
||||
{
|
||||
request.Method = Method.GET;
|
||||
return Execute<T>(request, statusCode);
|
||||
}
|
||||
|
||||
public T Post<T>(IRestRequest request, HttpStatusCode statusCode = HttpStatusCode.Created) where T : class, new()
|
||||
public T Post<T>(IRestRequest request, HttpStatusCode statusCode = HttpStatusCode.Created)
|
||||
where T : class, new()
|
||||
{
|
||||
request.Method = Method.POST;
|
||||
return Execute<T>(request, statusCode);
|
||||
}
|
||||
|
||||
public T Put<T>(IRestRequest request, HttpStatusCode statusCode = HttpStatusCode.Accepted) where T : class, new()
|
||||
public T Put<T>(IRestRequest request, HttpStatusCode statusCode = HttpStatusCode.Accepted)
|
||||
where T : class, new()
|
||||
{
|
||||
request.Method = Method.PUT;
|
||||
return Execute<T>(request, statusCode);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
using RestSharp;
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
using FluentAssertions;
|
||||
using System.Threading;
|
||||
using NUnit.Framework;
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using FluentAssertions;
|
||||
using Lidarr.Http.REST;
|
||||
using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
using RestSharp;
|
||||
|
||||
namespace NzbDrone.Integration.Test.Client
|
||||
{
|
||||
@@ -27,7 +27,10 @@ namespace NzbDrone.Integration.Test.Client
|
||||
[JsonIgnore]
|
||||
public Command Body { get; set; }
|
||||
[JsonProperty("body")]
|
||||
public Command BodyReadOnly { get { return Body; } }
|
||||
public Command BodyReadOnly
|
||||
{
|
||||
get { return Body; }
|
||||
}
|
||||
}
|
||||
|
||||
public class CommandClient : ClientBase<SimpleCommandResource>
|
||||
@@ -37,7 +40,8 @@ namespace NzbDrone.Integration.Test.Client
|
||||
{
|
||||
}
|
||||
|
||||
public SimpleCommandResource PostAndWait<T>(T command) where T : Command, new()
|
||||
public SimpleCommandResource PostAndWait<T>(T command)
|
||||
where T : Command, new()
|
||||
{
|
||||
var request = BuildRequest();
|
||||
request.AddJsonBody(command);
|
||||
@@ -72,7 +76,7 @@ namespace NzbDrone.Integration.Test.Client
|
||||
Thread.Sleep(500);
|
||||
resources = All();
|
||||
}
|
||||
|
||||
|
||||
Assert.Fail("Commands still processing");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,4 +21,4 @@ namespace NzbDrone.Integration.Test.Client
|
||||
return lines;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user