Skip to content

Commit

Permalink
Fix return type for get test item history endpoint
Browse files Browse the repository at this point in the history
Fix #128
  • Loading branch information
nvborisenko committed Nov 2, 2023
1 parent dbd5ae3 commit ebaef7a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 31 deletions.
3 changes: 1 addition & 2 deletions src/ReportPortal.Client/Abstractions/Models/ItemAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using ReportPortal.Client.Converters;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;

namespace ReportPortal.Client.Abstractions.Models
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,11 @@
using ReportPortal.Client.Abstractions.Models;
using ReportPortal.Client.Converters;
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
using System.Collections.Generic;

namespace ReportPortal.Client.Abstractions.Responses
{
public class TestItemHistoryContainer
{
public string GroupingField { get; set; }

public IList<TestItemHistoryElement> Resources { get; set; }
}

public class TestItemHistoryElement
{
public string Name { get; set; }

[JsonConverter(typeof(JsonStringEnumConverterEx<Status>))]
public Status Status { get; set; }

public long LaunchNumber { get; set; }

public long LaunchId { get; set; }

[JsonConverter(typeof(DateTimeUnixEpochConverter))]
public DateTime StartTime { get; set; }

[JsonConverter(typeof(JsonStringEnumConverterEx<Status>))]
public Status LaunchStatus { get; set; }

public IList<TestItemResponse> Resources { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -634,10 +634,12 @@ public async Task GetTestItemHistory()
{
var launchName = Guid.NewGuid().ToString();
var launch1 = await Service.Launch.StartAsync(new StartLaunchRequest { Name = launchName, StartTime = DateTime.UtcNow });
var test1 = await Service.TestItem.StartAsync(new StartTestItemRequest { LaunchUuid = launch1.Uuid, Name = "ABC", StartTime = DateTime.UtcNow });
var test1 = await Service.TestItem.StartAsync(new StartTestItemRequest
{ LaunchUuid = launch1.Uuid, Name = "ABC", StartTime = DateTime.UtcNow, Attributes = new List<ItemAttribute> { new ItemAttribute() { Key = "k1", Value = "v1" } } });

var launch2 = await Service.Launch.StartAsync(new StartLaunchRequest { Name = launchName, StartTime = DateTime.UtcNow });
var test2 = await Service.TestItem.StartAsync(new StartTestItemRequest { LaunchUuid = launch2.Uuid, Name = "ABC", StartTime = DateTime.UtcNow });
var test2 = await Service.TestItem.StartAsync(new StartTestItemRequest
{ LaunchUuid = launch2.Uuid, Name = "ABC", StartTime = DateTime.UtcNow, Attributes = new List<ItemAttribute> { new ItemAttribute() { Key = "k1", Value = "v1" } } });

var gotTest2 = await Service.TestItem.GetAsync(test2.Uuid);

Expand All @@ -647,12 +649,19 @@ public async Task GetTestItemHistory()
var element = histories.Items.First().Resources.First();
element.Name.Should().Be("ABC");
element.Status.Should().Be(Status.InProgress);
element.Attributes.Should().BeEquivalentTo(new List<ItemAttribute> { new ItemAttribute() { Key = "k1", Value = "v1" } });

var gotLaunch1 = await Service.Launch.GetAsync(launch1.Uuid);
var gotLaunch2 = await Service.Launch.GetAsync(launch2.Uuid);

await Service.Launch.StopAsync(gotLaunch1.Id, new FinishLaunchRequest { EndTime = DateTime.UtcNow });
await Service.Launch.StopAsync(gotLaunch2.Id, new FinishLaunchRequest { EndTime = DateTime.UtcNow });
await Service.Launch.StopAsync(gotLaunch1.Id, new FinishLaunchRequest
{
EndTime = DateTime.UtcNow
});
await Service.Launch.StopAsync(gotLaunch2.Id, new FinishLaunchRequest
{
EndTime = DateTime.UtcNow
});

await Service.Launch.DeleteAsync(gotLaunch1.Id);
await Service.Launch.DeleteAsync(gotLaunch2.Id);
Expand Down

0 comments on commit ebaef7a

Please sign in to comment.