Updated Git Data Tag With Signature Verification

This commit is contained in:
Sarmad
2016-07-13 20:13:33 +05:00
parent 6f3c8c4314
commit 032cf936b6
4 changed files with 26 additions and 3 deletions

View File

@@ -107,6 +107,26 @@ namespace Octokit.Tests.Integration.Clients
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);
}
}
}
}

View File

@@ -3,6 +3,7 @@ using System.Threading.Tasks;
using NSubstitute;
using Octokit;
using Octokit.Internal;
using Octokit.Tests;
using Xunit;
public class TagsClientTests
@@ -17,7 +18,7 @@ public class TagsClientTests
await client.Get("owner", "repo", "reference");
connection.Received().Get<GitTag>(Arg.Is<Uri>(u => u.ToString() == "repos/owner/repo/git/tags/reference"));
connection.Received().Get<GitTag>(Arg.Is<Uri>(u => u.ToString() == "repos/owner/repo/git/tags/reference"), Args.EmptyDictionary, "application/vnd.github.cryptographer-preview+sha");
}
[Fact]

View File

@@ -34,7 +34,7 @@ namespace Octokit
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
return ApiConnection.Get<GitTag>(ApiUrls.Tag(owner, name, reference));
return ApiConnection.Get<GitTag>(ApiUrls.Tag(owner, name, reference), null, AcceptHeaders.SignatureVerificationPreview);
}
/// <summary>
@@ -49,7 +49,7 @@ namespace Octokit
{
Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
return ApiConnection.Get<GitTag>(ApiUrls.Tag(repositoryId, reference));
return ApiConnection.Get<GitTag>(ApiUrls.Tag(repositoryId, reference), null, AcceptHeaders.SignatureVerificationPreview);
}
/// <summary>

View File

@@ -23,5 +23,7 @@ namespace Octokit
public Committer Tagger { get; protected set; }
public TagObject Object { get; protected set; }
public Verification Verification { get; protected set; }
}
}