Fixed: Calculates wrong age for releases pushed via ReleasePush api.
closes Zymest/autodl-curl-sonarr#3
This commit is contained in:
parent
d4e771117d
commit
c68ef626d2
|
@ -166,7 +166,7 @@ namespace NzbDrone.Api.Indexers
|
||||||
model.DownloadProtocol = resource.DownloadProtocol;
|
model.DownloadProtocol = resource.DownloadProtocol;
|
||||||
model.TvdbId = resource.TvdbId;
|
model.TvdbId = resource.TvdbId;
|
||||||
model.TvRageId = resource.TvRageId;
|
model.TvRageId = resource.TvRageId;
|
||||||
model.PublishDate = resource.PublishDate;
|
model.PublishDate = resource.PublishDate.ToUniversalTime();
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
using FluentAssertions;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Api.Indexers;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
|
namespace NzbDrone.Integration.Test.ApiTests
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class ReleasePushFixture : IntegrationTest
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void should_have_utc_date()
|
||||||
|
{
|
||||||
|
var body = new Dictionary<string, object>();
|
||||||
|
body.Add("guid", "sdfsdfsdf");
|
||||||
|
body.Add("title", "The.Series.S01E01");
|
||||||
|
body.Add("publishDate", DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ssZ", CultureInfo.InvariantCulture));
|
||||||
|
|
||||||
|
var request = ReleasePush.BuildRequest();
|
||||||
|
request.AddBody(body);
|
||||||
|
var result = ReleasePush.Post<ReleaseResource>(request, HttpStatusCode.OK);
|
||||||
|
|
||||||
|
result.Should().NotBeNull();
|
||||||
|
result.AgeHours.Should().BeApproximately(0, 0.1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
using NzbDrone.Api.Indexers;
|
||||||
|
using RestSharp;
|
||||||
|
|
||||||
|
namespace NzbDrone.Integration.Test.Client
|
||||||
|
{
|
||||||
|
public class ReleasePushClient : ClientBase<ReleaseResource>
|
||||||
|
{
|
||||||
|
public ReleasePushClient(IRestClient restClient, string apiKey)
|
||||||
|
: base(restClient, apiKey, "release/push")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -48,6 +48,7 @@ namespace NzbDrone.Integration.Test
|
||||||
public NotificationClient Notifications;
|
public NotificationClient Notifications;
|
||||||
public ClientBase<ProfileResource> Profiles;
|
public ClientBase<ProfileResource> Profiles;
|
||||||
public ReleaseClient Releases;
|
public ReleaseClient Releases;
|
||||||
|
public ReleasePushClient ReleasePush;
|
||||||
public ClientBase<RootFolderResource> RootFolders;
|
public ClientBase<RootFolderResource> RootFolders;
|
||||||
public SeriesClient Series;
|
public SeriesClient Series;
|
||||||
public ClientBase<TagResource> Tags;
|
public ClientBase<TagResource> Tags;
|
||||||
|
@ -108,6 +109,7 @@ namespace NzbDrone.Integration.Test
|
||||||
Notifications = new NotificationClient(RestClient, ApiKey);
|
Notifications = new NotificationClient(RestClient, ApiKey);
|
||||||
Profiles = new ClientBase<ProfileResource>(RestClient, ApiKey);
|
Profiles = new ClientBase<ProfileResource>(RestClient, ApiKey);
|
||||||
Releases = new ReleaseClient(RestClient, ApiKey);
|
Releases = new ReleaseClient(RestClient, ApiKey);
|
||||||
|
ReleasePush = new ReleasePushClient(RestClient, ApiKey);
|
||||||
RootFolders = new ClientBase<RootFolderResource>(RestClient, ApiKey);
|
RootFolders = new ClientBase<RootFolderResource>(RestClient, ApiKey);
|
||||||
Series = new SeriesClient(RestClient, ApiKey);
|
Series = new SeriesClient(RestClient, ApiKey);
|
||||||
Tags = new ClientBase<TagResource>(RestClient, ApiKey);
|
Tags = new ClientBase<TagResource>(RestClient, ApiKey);
|
||||||
|
|
|
@ -105,6 +105,7 @@
|
||||||
<Compile Include="ApiTests\DownloadClientFixture.cs" />
|
<Compile Include="ApiTests\DownloadClientFixture.cs" />
|
||||||
<Compile Include="ApiTests\EpisodeFileFixture.cs" />
|
<Compile Include="ApiTests\EpisodeFileFixture.cs" />
|
||||||
<Compile Include="ApiTests\FileSystemFixture.cs" />
|
<Compile Include="ApiTests\FileSystemFixture.cs" />
|
||||||
|
<Compile Include="ApiTests\ReleasePushFixture.cs" />
|
||||||
<Compile Include="ApiTests\SeriesLookupFixture.cs" />
|
<Compile Include="ApiTests\SeriesLookupFixture.cs" />
|
||||||
<Compile Include="ApiTests\WantedFixture.cs" />
|
<Compile Include="ApiTests\WantedFixture.cs" />
|
||||||
<Compile Include="Client\ClientBase.cs" />
|
<Compile Include="Client\ClientBase.cs" />
|
||||||
|
@ -113,6 +114,7 @@
|
||||||
<Compile Include="Client\DownloadClientClient.cs" />
|
<Compile Include="Client\DownloadClientClient.cs" />
|
||||||
<Compile Include="Client\NotificationClient.cs" />
|
<Compile Include="Client\NotificationClient.cs" />
|
||||||
<Compile Include="Client\CommandClient.cs" />
|
<Compile Include="Client\CommandClient.cs" />
|
||||||
|
<Compile Include="Client\ReleasePushClient.cs" />
|
||||||
<Compile Include="Client\ReleaseClient.cs" />
|
<Compile Include="Client\ReleaseClient.cs" />
|
||||||
<Compile Include="Client\SeriesClient.cs" />
|
<Compile Include="Client\SeriesClient.cs" />
|
||||||
<Compile Include="ApiTests\CommandFixture.cs" />
|
<Compile Include="ApiTests\CommandFixture.cs" />
|
||||||
|
|
Loading…
Reference in New Issue