mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-18 21:34:28 -04:00
Integration tests use the api key now
This commit is contained in:
@@ -14,10 +14,10 @@ namespace NzbDrone.Integration.Test.Client
|
||||
{
|
||||
private readonly IRestClient _restClient;
|
||||
private readonly string _resource;
|
||||
|
||||
private readonly string _apiKey;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public ClientBase(IRestClient restClient, string resource = null)
|
||||
public ClientBase(IRestClient restClient, string apiKey, string resource = null)
|
||||
{
|
||||
if (resource == null)
|
||||
{
|
||||
@@ -26,6 +26,7 @@ namespace NzbDrone.Integration.Test.Client
|
||||
|
||||
_restClient = restClient;
|
||||
_resource = resource;
|
||||
_apiKey = apiKey;
|
||||
|
||||
_logger = LogManager.GetLogger("REST");
|
||||
}
|
||||
@@ -88,10 +89,14 @@ namespace NzbDrone.Integration.Test.Client
|
||||
|
||||
public RestRequest BuildRequest(string command = "")
|
||||
{
|
||||
return new RestRequest(_resource + "/" + command.Trim('/'))
|
||||
var request = new RestRequest(_resource + "/" + command.Trim('/'))
|
||||
{
|
||||
RequestFormat = DataFormat.Json
|
||||
RequestFormat = DataFormat.Json,
|
||||
};
|
||||
|
||||
request.AddHeader("Authorization", _apiKey);
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
public T Get<T>(IRestRequest request, HttpStatusCode statusCode = HttpStatusCode.OK) where T : class, new()
|
||||
|
||||
@@ -6,8 +6,8 @@ namespace NzbDrone.Integration.Test.Client
|
||||
{
|
||||
public class EpisodeClient : ClientBase<EpisodeResource>
|
||||
{
|
||||
public EpisodeClient(IRestClient restClient)
|
||||
: base(restClient, "episodes")
|
||||
public EpisodeClient(IRestClient restClient, string apiKey)
|
||||
: base(restClient, apiKey, "episodes")
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -5,12 +5,9 @@ namespace NzbDrone.Integration.Test.Client
|
||||
{
|
||||
public class IndexerClient : ClientBase<IndexerResource>
|
||||
{
|
||||
public IndexerClient(IRestClient restClient)
|
||||
: base(restClient)
|
||||
public IndexerClient(IRestClient restClient, string apiKey)
|
||||
: base(restClient, apiKey)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5,12 +5,9 @@ namespace NzbDrone.Integration.Test.Client
|
||||
{
|
||||
public class ReleaseClient : ClientBase<ReleaseResource>
|
||||
{
|
||||
public ReleaseClient(IRestClient restClient)
|
||||
: base(restClient)
|
||||
public ReleaseClient(IRestClient restClient, string apiKey)
|
||||
: base(restClient, apiKey)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ namespace NzbDrone.Integration.Test.Client
|
||||
{
|
||||
public class SeriesClient : ClientBase<SeriesResource>
|
||||
{
|
||||
public SeriesClient(IRestClient restClient)
|
||||
: base(restClient)
|
||||
public SeriesClient(IRestClient restClient, string apiKey)
|
||||
: base(restClient, apiKey)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -27,14 +27,11 @@ namespace NzbDrone.Integration.Test.Client
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class SystemInfoClient : ClientBase<SeriesResource>
|
||||
{
|
||||
public SystemInfoClient(IRestClient restClient)
|
||||
: base(restClient)
|
||||
public SystemInfoClient(IRestClient restClient, string apiKey)
|
||||
: base(restClient, apiKey)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user