mirror of
https://github.com/lidarr/Lidarr
synced 2025-02-27 00:02:25 +00:00
Fixed: Calculates wrong age for releases pushed via ReleasePush api
This commit is contained in:
parent
c5661cba04
commit
641f8a88fa
5 changed files with 49 additions and 1 deletions
|
@ -139,7 +139,7 @@ public static ReleaseInfo ToModel(this ReleaseResource resource)
|
|||
model.IndexerId = resource.IndexerId;
|
||||
model.Indexer = resource.Indexer;
|
||||
model.DownloadProtocol = resource.DownloadProtocol;
|
||||
model.PublishDate = resource.PublishDate;
|
||||
model.PublishDate = resource.PublishDate.ToUniversalTime();
|
||||
|
||||
return model;
|
||||
}
|
||||
|
|
31
src/NzbDrone.Integration.Test/ApiTests/ReleasePushFixture.cs
Normal file
31
src/NzbDrone.Integration.Test/ApiTests/ReleasePushFixture.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using Lidarr.Api.V3.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 Artist - The Album");
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
13
src/NzbDrone.Integration.Test/Client/ReleasePushClient.cs
Normal file
13
src/NzbDrone.Integration.Test/Client/ReleasePushClient.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
using Lidarr.Api.V3.Indexers;
|
||||
using RestSharp;
|
||||
|
||||
namespace NzbDrone.Integration.Test.Client
|
||||
{
|
||||
public class ReleasePushClient : ClientBase<ReleaseResource>
|
||||
{
|
||||
public ReleasePushClient(IRestClient restClient, string apiKey)
|
||||
: base(restClient, apiKey, "release/push")
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -50,6 +50,7 @@ public abstract class IntegrationTestBase
|
|||
public NotificationClient Notifications;
|
||||
public ClientBase<QualityProfileResource> Profiles;
|
||||
public ReleaseClient Releases;
|
||||
public ReleasePushClient ReleasePush;
|
||||
public ClientBase<RootFolderResource> RootFolders;
|
||||
public ArtistClient Artist;
|
||||
public ClientBase<TagResource> Tags;
|
||||
|
@ -111,6 +112,7 @@ protected virtual void InitRestClients()
|
|||
Notifications = new NotificationClient(RestClient, ApiKey);
|
||||
Profiles = new ClientBase<QualityProfileResource>(RestClient, ApiKey);
|
||||
Releases = new ReleaseClient(RestClient, ApiKey);
|
||||
ReleasePush = new ReleasePushClient(RestClient, ApiKey);
|
||||
RootFolders = new ClientBase<RootFolderResource>(RestClient, ApiKey);
|
||||
Artist = new ArtistClient(RestClient, ApiKey);
|
||||
Tags = new ClientBase<TagResource>(RestClient, ApiKey);
|
||||
|
|
|
@ -99,12 +99,14 @@
|
|||
<Compile Include="ApiTests\CalendarFixture.cs" />
|
||||
<Compile Include="ApiTests\BlacklistFixture.cs" />
|
||||
<Compile Include="ApiTests\DownloadClientFixture.cs" />
|
||||
<Compile Include="ApiTests\ReleasePushFixture.cs" />
|
||||
<Compile Include="ApiTests\TrackFileFixture.cs" />
|
||||
<Compile Include="ApiTests\FileSystemFixture.cs" />
|
||||
<Compile Include="ApiTests\ArtistFixture.cs" />
|
||||
<Compile Include="ApiTests\ArtistLookupFixture.cs" />
|
||||
<Compile Include="ApiTests\WantedFixture.cs" />
|
||||
<Compile Include="Client\ClientBase.cs" />
|
||||
<Compile Include="Client\ReleasePushClient.cs" />
|
||||
<Compile Include="Client\TrackClient.cs" />
|
||||
<Compile Include="Client\AlbumClient.cs" />
|
||||
<Compile Include="Client\IndexerClient.cs" />
|
||||
|
|
Loading…
Reference in a new issue