-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1060 from daveaglick/star-creation-timestamps
Adds support for alternate accept header to retrieve star creation timestamps
- Loading branch information
Showing
15 changed files
with
390 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
using Octokit.Tests.Integration.Helpers; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
|
||
namespace Octokit.Tests.Integration.Clients | ||
{ | ||
public class StarredClientTests | ||
{ | ||
private readonly IGitHubClient _client; | ||
private readonly IStarredClient _fixture; | ||
|
||
public StarredClientTests() | ||
{ | ||
_client = Helper.GetAuthenticatedClient(); | ||
_fixture = _client.Activity.Starring; | ||
} | ||
|
||
[IntegrationTest] | ||
public async Task CanCreateAndRetrieveStarsWithTimestamps() | ||
{ | ||
using (var context = await _client.CreateRepositoryContext("public-repo")) | ||
{ | ||
await _fixture.RemoveStarFromRepo(context.RepositoryOwner, context.RepositoryName); | ||
await _fixture.StarRepo(context.RepositoryOwner, context.RepositoryName); | ||
var currentUser = await _client.User.Current(); | ||
var userStars = await _fixture.GetAllStargazersWithTimestamps(context.RepositoryOwner, context.RepositoryName); | ||
var userStar = userStars.SingleOrDefault(x => x.User.Id == currentUser.Id); | ||
Assert.NotNull(userStar); | ||
Assert.True(DateTimeOffset.UtcNow.Subtract(userStar.StarredAt) < TimeSpan.FromMinutes(5)); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.