[bug]: GetAllStargazersWithTimestamps was not returning timestamps (#2785)

This commit is contained in:
Tom Longhurst
2023-09-26 15:26:48 +01:00
committed by GitHub
parent 958bc5f1f8
commit 0238092ca0
6 changed files with 17 additions and 12 deletions
@@ -113,7 +113,7 @@ namespace Octokit.Reactive
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNull(options, nameof(options));
return _connection.GetAndFlattenAllPages<UserStar>(ApiUrls.Stargazers(owner, name), null, options);
return _connection.GetAndFlattenAllPages<UserStar>(ApiUrls.Stargazers(owner, name), null, AcceptHeaders.StarJson, options);
}
/// <summary>
@@ -126,7 +126,7 @@ namespace Octokit.Reactive
{
Ensure.ArgumentNotNull(options, nameof(options));
return _connection.GetAndFlattenAllPages<UserStar>(ApiUrls.Stargazers(repositoryId), null, options);
return _connection.GetAndFlattenAllPages<UserStar>(ApiUrls.Stargazers(repositoryId), null, AcceptHeaders.StarJson, options);
}
/// <summary>
@@ -736,6 +736,9 @@ namespace Octokit.Tests.Integration.Clients
var userStar = users.FirstOrDefault(star => star.User.Login == _repositoryContext.RepositoryOwner);
Assert.NotNull(userStar);
Assert.NotEqual(DateTimeOffset.MinValue, userStar.StarredAt);
Assert.NotNull(userStar.User);
Assert.NotNull(userStar.User.Login);
Assert.True(DateTimeOffset.UtcNow.Subtract(userStar.StarredAt) < TimeSpan.FromMinutes(5));
}
+4 -4
View File
@@ -412,7 +412,7 @@ namespace Octokit.Tests.Clients
await client.GetAllStargazersWithTimestamps("fake", "repo");
connection.Received().GetAll<UserStar>(endpoint, null, Args.ApiOptions);
connection.Received().GetAll<UserStar>(endpoint, null, AcceptHeaders.StarJson, Args.ApiOptions);
}
[Fact]
@@ -424,7 +424,7 @@ namespace Octokit.Tests.Clients
await client.GetAllStargazersWithTimestamps(1);
connection.Received().GetAll<UserStar>(endpoint, null, Args.ApiOptions);
connection.Received().GetAll<UserStar>(endpoint, null, AcceptHeaders.StarJson, Args.ApiOptions);
}
[Fact]
@@ -443,7 +443,7 @@ namespace Octokit.Tests.Clients
await client.GetAllStargazersWithTimestamps("fake", "repo", options);
connection.Received().GetAll<UserStar>(endpoint, null, options);
connection.Received().GetAll<UserStar>(endpoint, null, AcceptHeaders.StarJson, options);
}
[Fact]
@@ -462,7 +462,7 @@ namespace Octokit.Tests.Clients
await client.GetAllStargazersWithTimestamps(1, options);
connection.Received().GetAll<UserStar>(endpoint, null, options);
connection.Received().GetAll<UserStar>(endpoint, null, AcceptHeaders.StarJson, options);
}
[Fact]
@@ -102,7 +102,7 @@ namespace Octokit.Tests.Reactive
client.GetAllStargazersWithTimestamps("fight", "club");
connection.Received().Get<List<UserStar>>(endpoint, Args.EmptyDictionary);
connection.Received().Get<List<UserStar>>(endpoint, Args.EmptyDictionary, AcceptHeaders.StarJson);
}
[Fact]
@@ -116,7 +116,7 @@ namespace Octokit.Tests.Reactive
client.GetAllStargazersWithTimestamps(1);
connection.Received().Get<List<UserStar>>(endpoint, Args.EmptyDictionary);
connection.Received().Get<List<UserStar>>(endpoint, Args.EmptyDictionary, AcceptHeaders.StarJson);
}
[Fact]
@@ -137,7 +137,7 @@ namespace Octokit.Tests.Reactive
client.GetAllStargazersWithTimestamps("fight", "club", options);
connection.Received().Get<List<UserStar>>(endpoint, Arg.Is<IDictionary<string, string>>(d => d.Count == 2));
connection.Received().Get<List<UserStar>>(endpoint, Arg.Is<IDictionary<string, string>>(d => d.Count == 2), AcceptHeaders.StarJson);
}
[Fact]
@@ -158,7 +158,7 @@ namespace Octokit.Tests.Reactive
client.GetAllStargazersWithTimestamps(1, options);
connection.Received().Get<List<UserStar>>(endpoint, Arg.Is<IDictionary<string, string>>(d => d.Count == 2));
connection.Received().Get<List<UserStar>>(endpoint, Arg.Is<IDictionary<string, string>>(d => d.Count == 2), AcceptHeaders.StarJson);
}
[Fact]
+2 -2
View File
@@ -117,7 +117,7 @@ namespace Octokit
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNull(options, nameof(options));
return ApiConnection.GetAll<UserStar>(ApiUrls.Stargazers(owner, name), null, options);
return ApiConnection.GetAll<UserStar>(ApiUrls.Stargazers(owner, name), null, AcceptHeaders.StarJson, options);
}
/// <summary>
@@ -131,7 +131,7 @@ namespace Octokit
{
Ensure.ArgumentNotNull(options, nameof(options));
return ApiConnection.GetAll<UserStar>(ApiUrls.Stargazers(repositoryId), null, options);
return ApiConnection.GetAll<UserStar>(ApiUrls.Stargazers(repositoryId), null, AcceptHeaders.StarJson, options);
}
/// <summary>
+2
View File
@@ -15,5 +15,7 @@
public const string RawContentMediaType = "application/vnd.github.v3.raw";
public const string RepositoryContentMediaType = "application/vnd.github.v3.repository+json";
public const string StarJson = "application/vnd.github.v3.star+json";
}
}