diff --git a/Octokit.Tests.Integration/Clients/TagsClientTests.cs b/Octokit.Tests.Integration/Clients/TagsClientTests.cs index dd961b6a09..f4a5fd5900 100644 --- a/Octokit.Tests.Integration/Clients/TagsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/TagsClientTests.cs @@ -107,6 +107,26 @@ public async Task CreatesTagForRepositoryWithRepositoryId() Assert.Equal(gitTag.Message, "Hello"); Assert.Equal(gitTag.Object.Sha, sha); } + + [IntegrationTest] + public async Task DeserializeTagSignatureVerification() + { + var github = Helper.GetAuthenticatedClient(); + + var newTag = new NewTag { Message = "Hello", Type = TaggedType.Blob, Object = sha, Tag = "tag" }; + + var tag = await github.Git.Tag.Create(context.Repository.Id, newTag); + + var gitTag = await github.Git.Tag.Get(context.Repository.Id, tag.Sha); + + Assert.NotNull(gitTag); + + Assert.False(gitTag.Verification.Verified); + Assert.Equal(gitTag.Verification.Reason, VerificationReason.Unsigned); + Assert.Null(gitTag.Verification.Signature); + Assert.Null(gitTag.Verification.Payload); + + } } } } diff --git a/Octokit.Tests/Clients/TagsClientTests.cs b/Octokit.Tests/Clients/TagsClientTests.cs index d2e581096b..ec697e7abc 100644 --- a/Octokit.Tests/Clients/TagsClientTests.cs +++ b/Octokit.Tests/Clients/TagsClientTests.cs @@ -3,6 +3,7 @@ using NSubstitute; using Octokit; using Octokit.Internal; +using Octokit.Tests; using Xunit; public class TagsClientTests @@ -17,7 +18,7 @@ public async Task RequestsCorrectUrl() await client.Get("owner", "repo", "reference"); - connection.Received().Get(Arg.Is(u => u.ToString() == "repos/owner/repo/git/tags/reference")); + connection.Received().Get(Arg.Is(u => u.ToString() == "repos/owner/repo/git/tags/reference"), null, "application/vnd.github.cryptographer-preview+sha"); } [Fact] @@ -28,7 +29,7 @@ public async Task RequestsCorrectUrlWithRepositoryId() await client.Get(1, "reference"); - connection.Received().Get(Arg.Is(u => u.ToString() == "repositories/1/git/tags/reference")); + connection.Received().Get(Arg.Is(u => u.ToString() == "repositories/1/git/tags/reference"), null, "application/vnd.github.cryptographer-preview+sha"); } [Fact] diff --git a/Octokit/Clients/TagsClient.cs b/Octokit/Clients/TagsClient.cs index 24aa55375e..65bb9c5cd0 100644 --- a/Octokit/Clients/TagsClient.cs +++ b/Octokit/Clients/TagsClient.cs @@ -34,7 +34,7 @@ public Task Get(string owner, string name, string reference) Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNullOrEmptyString(reference, "reference"); - return ApiConnection.Get(ApiUrls.Tag(owner, name, reference)); + return ApiConnection.Get(ApiUrls.Tag(owner, name, reference), null, AcceptHeaders.SignatureVerificationPreview); } /// @@ -49,7 +49,7 @@ public Task Get(int repositoryId, string reference) { Ensure.ArgumentNotNullOrEmptyString(reference, "reference"); - return ApiConnection.Get(ApiUrls.Tag(repositoryId, reference)); + return ApiConnection.Get(ApiUrls.Tag(repositoryId, reference), null, AcceptHeaders.SignatureVerificationPreview); } /// diff --git a/Octokit/Models/Response/GitTag.cs b/Octokit/Models/Response/GitTag.cs index 3b0b6d0e9d..157be17f76 100644 --- a/Octokit/Models/Response/GitTag.cs +++ b/Octokit/Models/Response/GitTag.cs @@ -23,5 +23,7 @@ public GitTag(string url, string label, string @ref, string sha, User user, Repo public Committer Tagger { get; protected set; } public TagObject Object { get; protected set; } + + public Verification Verification { get; protected set; } } }