feat: Implement dependency review and dependency submission APIs (#2932)

Implement dependency review and dependency submission

Co-authored-by: André Pereira <Andre.LuisPereira@Student.HTW-Berlin.de>
This commit is contained in:
awedist
2024-06-15 00:03:11 +02:00
committed by GitHub
parent 6c43183837
commit 7d54cb0d85
39 changed files with 1949 additions and 8 deletions
@@ -0,0 +1,55 @@
using Octokit;
using Octokit.Tests.Integration;
using System.Linq;
using System.Threading.Tasks;
using Xunit;
/// <summary>
/// Base and head must have different dependencies
/// </summary>
public class DependencyReviewClientTests
{
public class TheGetAllMethod
{
readonly IDependencyReviewClient _fixture;
readonly IGitHubClient _github;
readonly string _owner;
readonly string _repo;
readonly string _base;
readonly string _head;
readonly long _repoId;
public TheGetAllMethod()
{
_github = Helper.GetAuthenticatedClient();
_fixture = _github.DependencyGraph.DependencyReview;
_owner = "octokit";
_repo = "octokit.net";
_base = "main";
_head = "brave-new-codegen-world";
_repoId = _github.Repository.Get(_owner, _repo).Result.Id;
}
[IntegrationTest]
public async Task GetDependencyDiffs()
{
var diffs = await _fixture.GetAll(_owner, _repo, _base, _head);
Assert.NotEmpty(diffs);
Assert.NotNull(diffs);
Assert.IsType<DependencyDiff>(diffs.First());
}
[IntegrationTest]
public async Task GetDependencyDiffsWithRepositoryId()
{
var diffs = await _fixture.GetAll(_repoId, _base, _head);
Assert.NotEmpty(diffs);
Assert.NotNull(diffs);
Assert.IsType<DependencyDiff>(diffs.First());
}
}
}