tests: Updates and fixes for tests, changing master to main and adding flaky tests marker (#2511)

This commit is contained in:
Chris Simpson
2022-07-25 16:36:09 +01:00
committed by GitHub
parent 9af552eeaa
commit 5fe3ea82f0
36 changed files with 494 additions and 491 deletions

View File

@@ -16,7 +16,7 @@ public class BlobClientTests : IDisposable
var github = Helper.GetAuthenticatedClient();
_fixture = github.Git.Blob;
_context = github.CreateRepositoryContext("public-repo").Result;
_context = github.CreateRepositoryContextWithAutoInit("public-repo").Result;
}
[IntegrationTest]

View File

@@ -18,7 +18,7 @@ public class CommitCommentReactionsClientTests
{
_github = Helper.GetAuthenticatedClient();
_context = _github.CreateRepositoryContext("public-repo").Result;
_context = _github.CreateRepositoryContextWithAutoInit("public-repo").Result;
}
private async Task<Commit> SetupCommitForRepository(IGitHubClient client)

View File

@@ -213,7 +213,7 @@ public class CommitStatusClientTests
{
_github = Helper.GetAuthenticatedClient();
_context = _github.CreateRepositoryContext("public-repo").Result;
_context = _github.CreateRepositoryContextWithAutoInit("public-repo").Result;
}
[IntegrationTest]

View File

@@ -12,7 +12,7 @@ public class CommitsClientTests
var github = Helper.GetAuthenticatedClient();
var fixture = github.Git.Commit;
using (var context = await github.CreateRepositoryContext("public-repo"))
using (var context = await github.CreateRepositoryContextWithAutoInit("public-repo"))
{
var owner = context.Repository.Owner.Login;
@@ -67,7 +67,7 @@ public class CommitsClientTests
var github = Helper.GetAuthenticatedClient();
var fixture = github.Git.Commit;
using (var context = await github.CreateRepositoryContext("public-repo"))
using (var context = await github.CreateRepositoryContextWithAutoInit("public-repo"))
{
var owner = context.Repository.Owner.Login;

View File

@@ -16,7 +16,7 @@ public class DeploymentStatusClientTests : IDisposable
var github = Helper.GetAuthenticatedClient();
_deploymentsClient = github.Repository.Deployment;
_context = github.CreateRepositoryContext("public-repo").Result;
_context = github.CreateRepositoryContextWithAutoInit("public-repo").Result;
var blob = new NewBlob
{

View File

@@ -17,7 +17,7 @@ public class DeploymentsClientTests : IDisposable
var github = Helper.GetAuthenticatedClient();
_deploymentsClient = github.Repository.Deployment;
_context = github.CreateRepositoryContext("public-repo").Result;
_context = github.CreateRepositoryContextWithAutoInit("public-repo").Result;
var blob = new NewBlob
{

View File

@@ -45,7 +45,7 @@ public class IssueCommentsClientTests
[IntegrationTest]
public async Task CanGetReactionPayload()
{
using (var context = await _github.CreateRepositoryContext(Helper.MakeNameWithTimestamp("IssueCommentsReactionTests")))
using (var context = await _github.CreateRepositoryContextWithAutoInit(Helper.MakeNameWithTimestamp("IssueCommentsReactionTests")))
{
// Create a test issue
var issueNumber = await HelperCreateIssue(context.RepositoryOwner, context.RepositoryName);
@@ -217,7 +217,7 @@ public class IssueCommentsClientTests
public async Task CanGetReactionPayload()
{
var numberToCreate = 2;
using (var context = await _github.CreateRepositoryContext(Helper.MakeNameWithTimestamp("IssueCommentsReactionTests")))
using (var context = await _github.CreateRepositoryContextWithAutoInit(Helper.MakeNameWithTimestamp("IssueCommentsReactionTests")))
{
var commentIds = new List<int>();
@@ -402,7 +402,7 @@ public class IssueCommentsClientTests
public async Task CanGetReactionPayload()
{
var numberToCreate = 2;
using (var context = await _github.CreateRepositoryContext(Helper.MakeNameWithTimestamp("IssueCommentsReactionTests")))
using (var context = await _github.CreateRepositoryContextWithAutoInit(Helper.MakeNameWithTimestamp("IssueCommentsReactionTests")))
{
var commentIds = new List<int>();

View File

@@ -1288,7 +1288,7 @@ public class IssuesClientTests : IDisposable
[IntegrationTest]
public async Task CanGetReactionPayload()
{
using (var context = await _github.CreateRepositoryContext(Helper.MakeNameWithTimestamp("IssuesReactionTests")))
using (var context = await _github.CreateRepositoryContextWithAutoInit(Helper.MakeNameWithTimestamp("IssuesReactionTests")))
{
// Create a test issue with reactions
var issueNumber = await HelperCreateIssue(context.RepositoryOwner, context.RepositoryName);
@@ -1312,7 +1312,7 @@ public class IssuesClientTests : IDisposable
public async Task CanGetReactionPayloadForMultipleIssues()
{
var numberToCreate = 2;
using (var context = await _github.CreateRepositoryContext(Helper.MakeNameWithTimestamp("IssuesReactionTests")))
using (var context = await _github.CreateRepositoryContextWithAutoInit(Helper.MakeNameWithTimestamp("IssuesReactionTests")))
{
var issueNumbers = new List<int>();

View File

@@ -22,7 +22,7 @@ public class MergingClientTests : IDisposable
};
_fixture = _github.Repository.Merging;
_context = _github.CreateRepositoryContext("public-repo").Result;
_context = _github.CreateRepositoryContextWithAutoInit("public-repo").Result;
}
[IntegrationTest]
@@ -30,12 +30,12 @@ public class MergingClientTests : IDisposable
{
await CreateTheWorld();
var newMerge = new NewMerge("master", branchName) { CommitMessage = "merge commit to master from integrationtests" };
var newMerge = new NewMerge("main", branchName) { CommitMessage = "merge commit to main from integrationtests" };
var merge = await _fixture.Create(_context.RepositoryOwner, _context.RepositoryName, newMerge);
Assert.NotNull(merge);
Assert.NotNull(merge.Commit);
Assert.Equal("merge commit to master from integrationtests", merge.Commit.Message);
Assert.Equal("merge commit to main from integrationtests", merge.Commit.Message);
}
[IntegrationTest]
@@ -43,28 +43,28 @@ public class MergingClientTests : IDisposable
{
await CreateTheWorld();
var newMerge = new NewMerge("master", branchName) { CommitMessage = "merge commit to master from integrationtests" };
var newMerge = new NewMerge("main", branchName) { CommitMessage = "merge commit to main from integrationtests" };
var merge = await _fixture.Create(_context.Repository.Id, newMerge);
Assert.NotNull(merge);
Assert.NotNull(merge.Commit);
Assert.Equal("merge commit to master from integrationtests", merge.Commit.Message);
Assert.Equal("merge commit to main from integrationtests", merge.Commit.Message);
}
async Task CreateTheWorld()
{
var master = await _github.Git.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/master");
var main = await _github.Git.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/main");
// create new commit for master branch
var newMasterTree = await CreateTree(new Dictionary<string, string> { { "README.md", "Hello World! I want to be overwritten by featurebranch!" } });
var newMaster = await CreateCommit("baseline for merge", newMasterTree.Sha, master.Object.Sha);
// create new commit for main branch
var newMainTree = await CreateTree(new Dictionary<string, string> { { "README.md", "Hello World! I want to be overwritten by featurebranch!" } });
var newMain = await CreateCommit("baseline for merge", newMainTree.Sha, main.Object.Sha);
// update master
await _github.Git.Reference.Update(Helper.UserName, _context.RepositoryName, "heads/master", new ReferenceUpdate(newMaster.Sha));
// update main
await _github.Git.Reference.Update(Helper.UserName, _context.RepositoryName, "heads/main", new ReferenceUpdate(newMain.Sha));
// create new commit for feature branch
var featureBranchTree = await CreateTree(new Dictionary<string, string> { { "README.md", "I am overwriting this blob with something new" } });
var featureBranchCommit = await CreateCommit("this is the commit to merge", featureBranchTree.Sha, newMaster.Sha);
var featureBranchCommit = await CreateCommit("this is the commit to merge", featureBranchTree.Sha, newMain.Sha);
// create branch
await _github.Git.Reference.Create(Helper.UserName, _context.RepositoryName, new NewReference("refs/heads/my-branch", featureBranchCommit.Sha));

View File

@@ -203,7 +203,7 @@ public class ProjectCardsClientTests
{
_github = Helper.GetAuthenticatedClient();
_context = _github.CreateRepositoryContext("public-repo").Result;
_context = _github.CreateRepositoryContextWithAutoInit("public-repo").Result;
}
[IntegrationTest]

View File

@@ -25,7 +25,7 @@ public class PullRequestReviewCommentReactionsClientTests : IDisposable
_client = _github.PullRequest.ReviewComment;
// We'll create a pull request that can be used by most tests
_context = _github.CreateRepositoryContext("test-repo").Result;
_context = _github.CreateUserRepositoryContext("test-repo").Result;
}
[IntegrationTest]
@@ -339,60 +339,6 @@ public class PullRequestReviewCommentReactionsClientTests : IDisposable
Assert.Equal(commentFromGitHub.User.Id, pullRequestReviewCommentReaction.User.Id);
}
[IntegrationTest]
public async Task CanDeleteReaction()
{
var pullRequest = await CreatePullRequest(_context);
const string body = "A review comment message";
const int position = 1;
var createdComment = await CreateComment(body, position, pullRequest.Sha, pullRequest.Number);
var commentFromGitHub = await _client.GetComment(Helper.UserName, _context.RepositoryName, createdComment.Id);
AssertComment(commentFromGitHub, body, position);
foreach (ReactionType reactionType in Enum.GetValues(typeof(ReactionType)))
{
var newReaction = new NewReaction(reactionType);
var reaction = await _github.Reaction.PullRequestReviewComment.Create(_context.RepositoryOwner, _context.RepositoryName, commentFromGitHub.Id, newReaction);
await _github.Reaction.PullRequestReviewComment.Delete(_context.RepositoryOwner, _context.RepositoryName, commentFromGitHub.Id, reaction.Id);
}
var allReactions = await _github.Reaction.PullRequestReviewComment.GetAll(_context.RepositoryOwner, _context.RepositoryName, commentFromGitHub.Id);
Assert.Empty(allReactions);
}
[IntegrationTest]
public async Task CanDeleteReactionWithRepositoryId()
{
var pullRequest = await CreatePullRequest(_context);
const string body = "A review comment message";
const int position = 1;
var createdComment = await CreateComment(body, position, pullRequest.Sha, pullRequest.Number);
var commentFromGitHub = await _client.GetComment(_context.RepositoryId, createdComment.Id);
AssertComment(commentFromGitHub, body, position);
foreach (ReactionType reactionType in Enum.GetValues(typeof(ReactionType)))
{
var newReaction = new NewReaction(reactionType);
var reaction = await _github.Reaction.PullRequestReviewComment.Create(_context.RepositoryId, commentFromGitHub.Id, newReaction);
await _github.Reaction.PullRequestReviewComment.Delete(_context.RepositoryId, commentFromGitHub.Id, reaction.Id);
}
var allReactions = await _github.Reaction.PullRequestReviewComment.GetAll(_context.RepositoryId, commentFromGitHub.Id);
Assert.Empty(allReactions);
}
/// <summary>
/// Creates the base state for testing (creates a repo, a commit in master, a branch, a commit in the branch and a pull request)
/// </summary>
@@ -403,11 +349,11 @@ public class PullRequestReviewCommentReactionsClientTests : IDisposable
// Creating a commit in master
var createdCommitInMaster = await CreateCommit(repoName, "Hello World!", "README.md", "heads/main", "A master commit message");
var createdCommitInMain = await CreateCommit(repoName, "Hello World!", "README.md", "heads/main", "A main commit message");
// Creating a branch
var newBranch = new NewReference(branchRef, createdCommitInMaster.Sha);
var newBranch = new NewReference(branchRef, createdCommitInMain.Sha);
await _github.Git.Reference.Create(Helper.UserName, repoName, newBranch);
// Creating a commit in the branch
@@ -416,7 +362,7 @@ public class PullRequestReviewCommentReactionsClientTests : IDisposable
// Creating a pull request
var pullRequest = new NewPullRequest("Nice title for the pull request", branchName, "main");
var pullRequest = new NewPullRequest("Nice title for the pull request", branchName, "master");
var createdPullRequest = await _github.PullRequest.Create(Helper.UserName, repoName, pullRequest);
var data = new PullRequestData

View File

@@ -23,7 +23,7 @@ public class PullRequestReviewCommentsClientTests : IDisposable
_client = _github.PullRequest.ReviewComment;
// We'll create a pull request that can be used by most tests
_context = _github.CreateRepositoryContext("test-repo").Result;
_context = _github.CreateRepositoryContextWithAutoInit("test-repo").Result;
}
[IntegrationTest]
@@ -844,7 +844,7 @@ public class PullRequestReviewCommentsClientTests : IDisposable
}
/// <summary>
/// Creates the base state for testing (creates a repo, a commit in master, a branch, a commit in the branch and a pull request)
/// Creates the base state for testing (creates a repo, a commit in main, a branch, a commit in the branch and a pull request)
/// </summary>
/// <returns></returns>
async Task<PullRequestData> CreatePullRequest(RepositoryContext context, string branch = branchName)
@@ -855,13 +855,13 @@ public class PullRequestReviewCommentsClientTests : IDisposable
var repoName = context.RepositoryName;
// Creating a commit in master
// Creating a commit in main
var createdCommitInMaster = await CreateCommit(repoName, "Hello World!", "README.md", "heads/master", "A master commit message");
var createdCommitInMain = await CreateCommit(repoName, "Hello World!", "README.md", "heads/main", "A main commit message");
// Creating a branch
var newBranch = new NewReference(branchRef, createdCommitInMaster.Sha);
var newBranch = new NewReference(branchRef, createdCommitInMain.Sha);
await _github.Git.Reference.Create(Helper.UserName, repoName, newBranch);
// Creating a commit in the branch
@@ -870,7 +870,7 @@ public class PullRequestReviewCommentsClientTests : IDisposable
// Creating a pull request
var pullRequest = new NewPullRequest("Nice title for the pull request", branch, "master");
var pullRequest = new NewPullRequest("Nice title for the pull request", branch, "main");
var createdPullRequest = await _github.PullRequest.Create(Helper.UserName, repoName, pullRequest);
var data = new PullRequestData
@@ -926,7 +926,7 @@ public class PullRequestReviewCommentsClientTests : IDisposable
public async Task CanGetReactionPayloadForPullRequestReviews()
{
int numberToCreate = 2;
using (var context = await _github.CreateRepositoryContext(Helper.MakeNameWithTimestamp("PullRequestReviewCommentsReactionTests")))
using (var context = await _github.CreateRepositoryContextWithAutoInit(Helper.MakeNameWithTimestamp("PullRequestReviewCommentsReactionTests")))
{
var commentIds = new List<int>();
@@ -965,7 +965,7 @@ public class PullRequestReviewCommentsClientTests : IDisposable
public async Task CanGetReactionPayloadForRepositoryPullRequestReviews()
{
int numberToCreate = 2;
using (var context = await _github.CreateRepositoryContext(Helper.MakeNameWithTimestamp("PullRequestReviewCommentsReactionTests")))
using (var context = await _github.CreateRepositoryContextWithAutoInit(Helper.MakeNameWithTimestamp("PullRequestReviewCommentsReactionTests")))
{
var commentIds = new List<int>();

View File

@@ -26,7 +26,7 @@ public class PullRequestReviewRequestsClientTests
_client = _github.PullRequest.ReviewRequest;
_context = _github.CreateRepositoryContext("test-repo").Result;
_context = _github.CreateRepositoryContextWithAutoInit("test-repo").Result;
Task.WaitAll(_collaboratorLogins.Select(AddCollaborator).ToArray());
}
@@ -144,18 +144,18 @@ public class PullRequestReviewRequestsClientTests
static async Task<int> CreateTheWorld(IGitHubClient github, RepositoryContext context, bool createReviewRequests = true)
{
var master = await github.Git.Reference.Get(context.RepositoryOwner, context.RepositoryName, "heads/master");
var main = await github.Git.Reference.Get(context.RepositoryOwner, context.RepositoryName, "heads/main");
// create new commit for master branch
var newMasterTree = await CreateTree(github, context, new Dictionary<string, string> { { "README.md", "Hello World!" } });
var newMaster = await CreateCommit(github, context, "baseline for pull request", newMasterTree.Sha, master.Object.Sha);
// create new commit for main branch
var newMainTree = await CreateTree(github, context, new Dictionary<string, string> { { "README.md", "Hello World!" } });
var newMain = await CreateCommit(github, context, "baseline for pull request", newMainTree.Sha, main.Object.Sha);
// update master
await github.Git.Reference.Update(context.RepositoryOwner, context.RepositoryName, "heads/master", new ReferenceUpdate(newMaster.Sha));
// update main
await github.Git.Reference.Update(context.RepositoryOwner, context.RepositoryName, "heads/main", new ReferenceUpdate(newMain.Sha));
// create new commit for feature branch
var featureBranchTree = await CreateTree(github, context, new Dictionary<string, string> { { "README.md", "I am overwriting this blob with something new" } });
var featureBranchCommit = await CreateCommit(github, context, "this is the commit to merge into the pull request", featureBranchTree.Sha, newMaster.Sha);
var featureBranchCommit = await CreateCommit(github, context, "this is the commit to merge into the pull request", featureBranchTree.Sha, newMain.Sha);
var featureBranchTree2 = await CreateTree(github, context, new Dictionary<string, string> { { "README.md", "I am overwriting this blob with something new a 2nd time" } });
var featureBranchCommit2 = await CreateCommit(github, context, "this is a 2nd commit to merge into the pull request", featureBranchTree2.Sha, featureBranchCommit.Sha);
@@ -164,7 +164,7 @@ public class PullRequestReviewRequestsClientTests
await github.Git.Reference.Create(context.RepositoryOwner, context.RepositoryName, new NewReference("refs/heads/my-branch", featureBranchCommit2.Sha));
// create a pull request
var pullRequest = new NewPullRequest("Nice title for the pull request", "my-branch", "master");
var pullRequest = new NewPullRequest("Nice title for the pull request", "my-branch", "main");
var createdPullRequest = await github.PullRequest.Create(context.RepositoryOwner, context.RepositoryName, pullRequest);
// Create review requests (optional)

View File

@@ -126,7 +126,7 @@ public class PullRequestReviewsClientTests
[DualAccountTest]
public async Task CanCreatePendingReview()
{
using (var context = await _github.CreateRepositoryContext("test-repo"))
using (var context = await _github.CreateRepositoryContextWithAutoInit("test-repo"))
{
await _github.CreateTheWorld(context.Repository);
var pullRequest = await _github2.CreatePullRequest(context.Repository);
@@ -156,7 +156,7 @@ public class PullRequestReviewsClientTests
[DualAccountTest]
public async Task CanCreatePendingReviewWithRepositoryId()
{
using (var context = await _github.CreateRepositoryContext("test-repo"))
using (var context = await _github.CreateRepositoryContextWithAutoInit("test-repo"))
{
await _github.CreateTheWorld(context.Repository);
var pullRequest = await _github2.CreatePullRequest(context.Repository);
@@ -186,7 +186,7 @@ public class PullRequestReviewsClientTests
[DualAccountTest]
public async Task CanCreateCommentedReview()
{
using (var context = await _github.CreateRepositoryContext("test-repo"))
using (var context = await _github.CreateRepositoryContextWithAutoInit("test-repo"))
{
await _github.CreateTheWorld(context.Repository);
var pullRequest = await _github2.CreatePullRequest(context.Repository);
@@ -217,7 +217,7 @@ public class PullRequestReviewsClientTests
[DualAccountTest]
public async Task CanCreateCommentedReviewWithRepositoryId()
{
using (var context = await _github.CreateRepositoryContext("test-repo"))
using (var context = await _github.CreateRepositoryContextWithAutoInit("test-repo"))
{
await _github.CreateTheWorld(context.Repository);
var pullRequest = await _github2.CreatePullRequest(context.Repository);
@@ -248,7 +248,7 @@ public class PullRequestReviewsClientTests
[DualAccountTest]
public async Task CanCreateChangesRequestedReview()
{
using (var context = await _github.CreateRepositoryContext("test-repo"))
using (var context = await _github.CreateRepositoryContextWithAutoInit("test-repo"))
{
await _github.CreateTheWorld(context.Repository);
var pullRequest = await _github2.CreatePullRequest(context.Repository);
@@ -279,7 +279,7 @@ public class PullRequestReviewsClientTests
[DualAccountTest]
public async Task CanCreateChangesRequestedReviewWithRepositoryId()
{
using (var context = await _github.CreateRepositoryContext("test-repo"))
using (var context = await _github.CreateRepositoryContextWithAutoInit("test-repo"))
{
await _github.CreateTheWorld(context.Repository);
var pullRequest = await _github2.CreatePullRequest(context.Repository);
@@ -310,7 +310,7 @@ public class PullRequestReviewsClientTests
[DualAccountTest]
public async Task CanCreateApprovedReview()
{
using (var context = await _github.CreateRepositoryContext("test-repo"))
using (var context = await _github.CreateRepositoryContextWithAutoInit("test-repo"))
{
await _github.CreateTheWorld(context.Repository);
var pullRequest = await _github2.CreatePullRequest(context.Repository);
@@ -341,7 +341,7 @@ public class PullRequestReviewsClientTests
[DualAccountTest]
public async Task CanCreateApprovedReviewWithRepositoryId()
{
using (var context = await _github.CreateRepositoryContext("test-repo"))
using (var context = await _github.CreateRepositoryContextWithAutoInit("test-repo"))
{
await _github.CreateTheWorld(context.Repository);
var pullRequest = await _github2.CreatePullRequest(context.Repository);
@@ -388,7 +388,7 @@ public class PullRequestReviewsClientTests
[DualAccountTest]
public async Task CanDeleteReview()
{
using (var context = await _github.CreateRepositoryContext("test-repo"))
using (var context = await _github.CreateRepositoryContextWithAutoInit("test-repo"))
{
await _github.CreateTheWorld(context.Repository);
var pullRequest = await _github2.CreatePullRequest(context.Repository);
@@ -405,7 +405,7 @@ public class PullRequestReviewsClientTests
[DualAccountTest]
public async Task CanDeleteReviewWithRepositoryId()
{
using (var context = await _github.CreateRepositoryContext("test-repo"))
using (var context = await _github.CreateRepositoryContextWithAutoInit("test-repo"))
{
await _github.CreateTheWorld(context.Repository);
var pullRequest = await _github2.CreatePullRequest(context.Repository);
@@ -438,7 +438,7 @@ public class PullRequestReviewsClientTests
[DualAccountTest]
public async Task CanDismissReview()
{
using (var context = await _github.CreateRepositoryContext("test-repo"))
using (var context = await _github.CreateRepositoryContextWithAutoInit("test-repo"))
{
await _github.CreateTheWorld(context.Repository);
var pullRequest = await _github2.CreatePullRequest(context.Repository);
@@ -453,7 +453,7 @@ public class PullRequestReviewsClientTests
[DualAccountTest]
public async Task CanDismissReviewWithRepositoryId()
{
using (var context = await _github.CreateRepositoryContext("test-repo"))
using (var context = await _github.CreateRepositoryContextWithAutoInit("test-repo"))
{
await _github.CreateTheWorld(context.Repository);
var pullRequest = await _github2.CreatePullRequest(context.Repository);
@@ -565,7 +565,7 @@ public class PullRequestReviewsClientTests
[DualAccountTest]
public async Task CanSubmitCommentedReview()
{
using (var context = await _github.CreateRepositoryContext("test-repo"))
using (var context = await _github.CreateRepositoryContextWithAutoInit("test-repo"))
{
await _github.CreateTheWorld(context.Repository);
var pullRequest = await _github2.CreatePullRequest(context.Repository);
@@ -586,7 +586,7 @@ public class PullRequestReviewsClientTests
[DualAccountTest]
public async Task CanSubmitCommentedReviewWithRepositoryId()
{
using (var context = await _github.CreateRepositoryContext("test-repo"))
using (var context = await _github.CreateRepositoryContextWithAutoInit("test-repo"))
{
await _github.CreateTheWorld(context.Repository);
var pullRequest = await _github2.CreatePullRequest(context.Repository);
@@ -607,7 +607,7 @@ public class PullRequestReviewsClientTests
[DualAccountTest]
public async Task CanSubmitChangesRequestedReview()
{
using (var context = await _github.CreateRepositoryContext("test-repo"))
using (var context = await _github.CreateRepositoryContextWithAutoInit("test-repo"))
{
await _github.CreateTheWorld(context.Repository);
var pullRequest = await _github2.CreatePullRequest(context.Repository);
@@ -628,7 +628,7 @@ public class PullRequestReviewsClientTests
[DualAccountTest]
public async Task CanSubmitChangesRequestedReviewWithRepositoryId()
{
using (var context = await _github.CreateRepositoryContext("test-repo"))
using (var context = await _github.CreateRepositoryContextWithAutoInit("test-repo"))
{
await _github.CreateTheWorld(context.Repository);
var pullRequest = await _github2.CreatePullRequest(context.Repository);
@@ -649,7 +649,7 @@ public class PullRequestReviewsClientTests
[DualAccountTest]
public async Task CanSubmitApprovedReview()
{
using (var context = await _github.CreateRepositoryContext("test-repo"))
using (var context = await _github.CreateRepositoryContextWithAutoInit("test-repo"))
{
await _github.CreateTheWorld(context.Repository);
var pullRequest = await _github2.CreatePullRequest(context.Repository);
@@ -670,7 +670,7 @@ public class PullRequestReviewsClientTests
[DualAccountTest]
public async Task CanSubmitApprovedReviewWithRepositoryId()
{
using (var context = await _github.CreateRepositoryContext("test-repo"))
using (var context = await _github.CreateRepositoryContextWithAutoInit("test-repo"))
{
await _github.CreateTheWorld(context.Repository);
var pullRequest = await _github2.CreatePullRequest(context.Repository);

View File

@@ -25,7 +25,7 @@ public class PullRequestsClientTests : IDisposable
_fixture = _github.Repository.PullRequest;
_repositoryCommentsClient = _github.Repository.Comment;
_context = _github.CreateRepositoryContext("source-repo").Result;
_context = _github.CreateRepositoryContextWithAutoInit("source-repo").Result;
}
[IntegrationTest]
@@ -33,7 +33,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
Assert.Equal("a pull request", result.Title);
}
@@ -43,7 +43,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a draft pull request", branchName, "master") { Draft = true };
var newPullRequest = new NewPullRequest("a draft pull request", branchName, "main") { Draft = true };
var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
Assert.Equal("a draft pull request", result.Title);
Assert.True(result.Draft);
@@ -55,7 +55,7 @@ public class PullRequestsClientTests : IDisposable
await CreateTheWorld();
var newIssue = await _github.Issue.Create(Helper.UserName, _context.RepositoryName, new NewIssue("an issue"));
var newPullRequest = new NewPullRequest(newIssue.Number, branchName, "master");
var newPullRequest = new NewPullRequest(newIssue.Number, branchName, "main");
var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
Assert.Equal(newIssue.Number, result.Number);
Assert.Equal(newIssue.Title, result.Title);
@@ -66,7 +66,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var result = await _fixture.Create(_context.Repository.Id, newPullRequest);
Assert.Equal("a pull request", result.Title);
}
@@ -76,7 +76,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a draft pull request", branchName, "master") { Draft = true };
var newPullRequest = new NewPullRequest("a draft pull request", branchName, "main") { Draft = true };
var result = await _fixture.Create(_context.Repository.Id, newPullRequest);
Assert.Equal("a draft pull request", result.Title);
Assert.True(result.Draft);
@@ -88,7 +88,7 @@ public class PullRequestsClientTests : IDisposable
await CreateTheWorld();
var newIssue = await _github.Issue.Create(_context.RepositoryId, new NewIssue("an issue"));
var newPullRequest = new NewPullRequest(newIssue.Number, branchName, "master");
var newPullRequest = new NewPullRequest(newIssue.Number, branchName, "main");
var result = await _fixture.Create(_context.Repository.Id, newPullRequest);
Assert.Equal(newIssue.Number, result.Number);
Assert.Equal(newIssue.Title, result.Title);
@@ -99,7 +99,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName);
@@ -114,7 +114,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a draft pull request", branchName, "master") { Draft = true };
var newPullRequest = new NewPullRequest("a draft pull request", branchName, "main") { Draft = true };
var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName);
@@ -130,7 +130,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
var pullRequests = await _fixture.GetAllForRepository(_context.Repository.Id);
@@ -144,7 +144,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a draft pull request", branchName, "master") { Draft = true };
var newPullRequest = new NewPullRequest("a draft pull request", branchName, "main") { Draft = true };
var result = await _fixture.Create(_context.Repository.Id, newPullRequest);
var pullRequests = await _fixture.GetAllForRepository(_context.Repository.Id);
@@ -160,7 +160,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
// Add an assignee
@@ -183,7 +183,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var result = await _fixture.Create(_context.Repository.Id, newPullRequest);
// Add an assignee
@@ -206,7 +206,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
// Add a label
@@ -229,7 +229,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var result = await _fixture.Create(_context.Repository.Id, newPullRequest);
// Add a label
@@ -252,7 +252,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
var options = new ApiOptions
@@ -272,7 +272,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
var options = new ApiOptions
@@ -292,8 +292,8 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master");
var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master");
var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "main");
var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "main");
await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest1);
var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest2);
@@ -315,8 +315,8 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master");
var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master");
var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "main");
var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "main");
await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest1);
var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest2);
@@ -338,8 +338,8 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master");
var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master");
var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "main");
var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "main");
await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest1);
await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest2);
@@ -368,8 +368,8 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master");
var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master");
var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "main");
var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "main");
await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest1);
await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest2);
@@ -398,7 +398,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
var openPullRequests = new PullRequestRequest { State = ItemStateFilter.Open };
@@ -413,7 +413,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
var openPullRequests = new PullRequestRequest { State = ItemStateFilter.Open };
@@ -428,7 +428,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
var options = new ApiOptions
@@ -449,7 +449,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
var options = new ApiOptions
@@ -470,8 +470,8 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master");
var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master");
var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "main");
var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "main");
await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest1);
var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest2);
@@ -494,8 +494,8 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master");
var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master");
var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "main");
var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "main");
await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest1);
var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest2);
@@ -518,8 +518,8 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master");
var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master");
var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "main");
var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "main");
await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest1);
await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest2);
@@ -550,8 +550,8 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master");
var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master");
var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "main");
var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "main");
await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest1);
await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest2);
@@ -582,7 +582,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
var openPullRequests = new PullRequestRequest { State = ItemStateFilter.Closed };
@@ -596,7 +596,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
var openPullRequests = new PullRequestRequest { State = ItemStateFilter.Closed };
@@ -610,7 +610,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
var updatePullRequest = new PullRequestUpdate { Title = "updated title", Body = "Hello New Body", Base = "my-other-branch" };
@@ -626,7 +626,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
var updatePullRequest = new PullRequestUpdate { Title = "updated title", Body = "Hello New Body", Base = "my-other-branch" };
@@ -642,7 +642,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
var updatePullRequest = new PullRequestUpdate { State = ItemState.Closed };
@@ -658,7 +658,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
var updatePullRequest = new PullRequestUpdate { State = ItemState.Closed };
@@ -675,10 +675,10 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
var newPullRequest2 = new NewPullRequest("another pull request", otherBranchName, "master");
var newPullRequest2 = new NewPullRequest("another pull request", otherBranchName, "main");
var anotherPullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest2);
var updatePullRequest = new PullRequestUpdate { Body = "This is the body" };
@@ -698,10 +698,10 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
var newPullRequest2 = new NewPullRequest("another pull request", otherBranchName, "master");
var newPullRequest2 = new NewPullRequest("another pull request", otherBranchName, "main");
var anotherPullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest2);
var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName, new PullRequestRequest { SortDirection = SortDirection.Ascending });
@@ -716,7 +716,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
var result = await _fixture.Merged(Helper.UserName, _context.RepositoryName, pullRequest.Number);
@@ -729,7 +729,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
var result = await _fixture.Merged(_context.Repository.Id, pullRequest.Number);
@@ -742,7 +742,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
var merge = new MergePullRequest { CommitMessage = "thing the thing" };
@@ -756,7 +756,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
var merge = new MergePullRequest { CommitMessage = "thing the thing" };
@@ -770,7 +770,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
var merge = new MergePullRequest();
@@ -784,7 +784,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
var merge = new MergePullRequest { CommitMessage = "thing the thing", Sha = pullRequest.Head.Sha };
@@ -798,7 +798,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("squash commit pull request", branchName, "master");
var newPullRequest = new NewPullRequest("squash commit pull request", branchName, "main");
var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
var merge = new MergePullRequest { CommitMessage = "fake commit message", CommitTitle = "fake title", MergeMethod = PullRequestMergeMethod.Merge };
@@ -814,7 +814,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("squash commit pull request", branchName, "master");
var newPullRequest = new NewPullRequest("squash commit pull request", branchName, "main");
var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
var merge = new MergePullRequest { CommitMessage = "fake commit message", CommitTitle = "fake title", MergeMethod = PullRequestMergeMethod.Squash };
@@ -830,7 +830,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("squash commit pull request", branchName, "master");
var newPullRequest = new NewPullRequest("squash commit pull request", branchName, "main");
var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
var merge = new MergePullRequest { CommitMessage = "fake commit message", CommitTitle = "fake title", MergeMethod = PullRequestMergeMethod.Rebase };
@@ -847,7 +847,7 @@ public class PullRequestsClientTests : IDisposable
await CreateTheWorld();
var fakeSha = new string('f', 40);
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
var merge = new MergePullRequest { Sha = fakeSha };
@@ -861,12 +861,12 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var master = await _github.Git.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/master");
var newMasterTree = await CreateTree(new Dictionary<string, string> { { "README.md", "Hello World, we meet again!" } });
var masterCommit = await CreateCommit("Commit in master", newMasterTree.Sha, master.Object.Sha);
await _github.Git.Reference.Update(Helper.UserName, _context.RepositoryName, "heads/master", new ReferenceUpdate(masterCommit.Sha));
var main = await _github.Git.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/main");
var newMainTree = await CreateTree(new Dictionary<string, string> { { "README.md", "Hello World, we meet again!" } });
var mainCommit = await CreateCommit("Commit in main", newMainTree.Sha, main.Object.Sha);
await _github.Git.Reference.Update(Helper.UserName, _context.RepositoryName, "heads/main", new ReferenceUpdate(mainCommit.Sha));
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
await Task.Delay(TimeSpan.FromSeconds(5));
@@ -883,19 +883,19 @@ public class PullRequestsClientTests : IDisposable
}
[IntegrationTest]
public async Task UpdatesMaster()
public async Task UpdatesMain()
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
var merge = new MergePullRequest { CommitMessage = "thing the thing" };
var result = await _fixture.Merge(Helper.UserName, _context.RepositoryName, pullRequest.Number, merge);
var master = await _github.Git.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/master");
var main = await _github.Git.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/main");
Assert.Equal(result.Sha, master.Object.Sha);
Assert.Equal(result.Sha, main.Object.Sha);
}
[IntegrationTest]
@@ -903,7 +903,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
var result = await _fixture.Commits(Helper.UserName, _context.RepositoryName, pullRequest.Number);
@@ -917,7 +917,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
var result = await _fixture.Commits(_context.Repository.Id, pullRequest.Number);
@@ -931,7 +931,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
// create new commit for branch
@@ -963,7 +963,7 @@ public class PullRequestsClientTests : IDisposable
{
await CreateTheWorld();
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var newPullRequest = new NewPullRequest("a pull request", branchName, "main");
var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
// create new commit for branch
@@ -1040,18 +1040,18 @@ public class PullRequestsClientTests : IDisposable
async Task CreateTheWorld()
{
var master = await _github.Git.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/master");
var main = await _github.Git.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/main");
// create new commit for master branch
var newMasterTree = await CreateTree(new Dictionary<string, string> { { "README.md", "Hello World!" } });
var newMaster = await CreateCommit("baseline for pull request", newMasterTree.Sha, master.Object.Sha);
// create new commit for main branch
var newMainTree = await CreateTree(new Dictionary<string, string> { { "README.md", "Hello World!" } });
var newMain = await CreateCommit("baseline for pull request", newMainTree.Sha, main.Object.Sha);
// update master
await _github.Git.Reference.Update(Helper.UserName, _context.RepositoryName, "heads/master", new ReferenceUpdate(newMaster.Sha));
// update main
await _github.Git.Reference.Update(Helper.UserName, _context.RepositoryName, "heads/main", new ReferenceUpdate(newMain.Sha));
// create new commit for feature branch
var featureBranchTree = await CreateTree(new Dictionary<string, string> { { "README.md", "I am overwriting this blob with something new" } });
var featureBranchCommit = await CreateCommit("this is the commit to merge into the pull request", featureBranchTree.Sha, newMaster.Sha);
var featureBranchCommit = await CreateCommit("this is the commit to merge into the pull request", featureBranchTree.Sha, newMain.Sha);
var featureBranchTree2 = await CreateTree(new Dictionary<string, string> { { "README.md", "I am overwriting this blob with something new a 2nd time" } });
var featureBranchCommit2 = await CreateCommit("this is a 2nd commit to merge into the pull request", featureBranchTree2.Sha, featureBranchCommit.Sha);
@@ -1060,7 +1060,7 @@ public class PullRequestsClientTests : IDisposable
await _github.Git.Reference.Create(Helper.UserName, _context.RepositoryName, new NewReference("refs/heads/my-branch", featureBranchCommit2.Sha));
var otherFeatureBranchTree = await CreateTree(new Dictionary<string, string> { { "README.md", "I am overwriting this blob with something else" } });
var otherFeatureBranchCommit = await CreateCommit("this is the other commit to merge into the other pull request", otherFeatureBranchTree.Sha, newMaster.Sha);
var otherFeatureBranchCommit = await CreateCommit("this is the other commit to merge into the other pull request", otherFeatureBranchTree.Sha, newMain.Sha);
await _github.Git.Reference.Create(Helper.UserName, _context.RepositoryName, new NewReference("refs/heads/my-other-branch", otherFeatureBranchCommit.Sha));
}

View File

@@ -18,17 +18,17 @@ public class ReferencesClientTests : IDisposable
_fixture = _github.Git.Reference;
_context = _github.CreateRepositoryContext("public-repo").Result;
_context = _github.CreateRepositoryContextWithAutoInit("public-repo").Result;
}
[IntegrationTest]
public async Task CanGetAReference()
{
var @ref = await _fixture.Get("octokit", "octokit.net", "heads/master");
var @ref = await _fixture.Get("octokit", "octokit.net", "heads/main");
// validate the top-level properties
Assert.Equal("refs/heads/master", @ref.Ref);
Assert.Equal("https://api.github.com/repos/octokit/octokit.net/git/refs/heads/master", @ref.Url);
Assert.Equal("refs/heads/main", @ref.Ref);
Assert.Equal("https://api.github.com/repos/octokit/octokit.net/git/refs/heads/main", @ref.Url);
// validate the git reference
Assert.Equal(TaggedType.Commit, @ref.Object.Type);
@@ -38,11 +38,11 @@ public class ReferencesClientTests : IDisposable
[IntegrationTest]
public async Task CanGetAReferenceWithRepositoryId()
{
var @ref = await _fixture.Get(7528679, "heads/master");
var @ref = await _fixture.Get(7528679, "heads/main");
// validate the top-level properties
Assert.Equal("refs/heads/master", @ref.Ref);
Assert.Equal("https://api.github.com/repos/octokit/octokit.net/git/refs/heads/master", @ref.Url);
Assert.Equal("refs/heads/main", @ref.Ref);
Assert.Equal("https://api.github.com/repos/octokit/octokit.net/git/refs/heads/main", @ref.Url);
// validate the git reference
Assert.Equal(TaggedType.Commit, @ref.Object.Type);

View File

@@ -32,7 +32,7 @@ public class ReleasesClientTests
var github = Helper.GetAuthenticatedClient();
_releaseClient = github.Repository.Release;
_context = github.CreateRepositoryContext("public-repo").Result;
_context = github.CreateRepositoryContextWithAutoInit("public-repo").Result;
}
[IntegrationTest]
@@ -71,7 +71,7 @@ public class ReleasesClientTests
var github = Helper.GetAuthenticatedClient();
_releaseClient = github.Repository.Release;
_context = github.CreateRepositoryContext("public-repo").Result;
_context = github.CreateRepositoryContextWithAutoInit("public-repo").Result;
}
[IntegrationTest]
@@ -365,7 +365,7 @@ public class ReleasesClientTests
_github = Helper.GetAuthenticatedClient();
_releaseClient = _github.Repository.Release;
_context = _github.CreateRepositoryContext("public-repo").Result;
_context = _github.CreateRepositoryContextWithAutoInit("public-repo").Result;
}
[IntegrationTest]
@@ -408,7 +408,7 @@ public class ReleasesClientTests
var releaseWithNoUpdate = new NewRelease("0.1") { Draft = true };
var release = await _releaseClient.Create(_context.RepositoryOwner, _context.RepositoryName, releaseWithNoUpdate);
Assert.Equal("master", release.TargetCommitish);
Assert.Equal("main", release.TargetCommitish);
var newHead = await _github.CreateTheWorld(_context.Repository);
@@ -429,7 +429,7 @@ public class ReleasesClientTests
var releaseWithNoUpdate = new NewRelease("0.1") { Draft = true };
var release = await _releaseClient.Create(_context.Repository.Id, releaseWithNoUpdate);
Assert.Equal("master", release.TargetCommitish);
Assert.Equal("main", release.TargetCommitish);
var newHead = await _github.CreateTheWorld(_context.Repository);
@@ -465,7 +465,7 @@ public class ReleasesClientTests
_github = Helper.GetAuthenticatedClient();
_releaseClient = _github.Repository.Release;
_context = _github.CreateRepositoryContext("public-repo").Result;
_context = _github.CreateRepositoryContextWithAutoInit("public-repo").Result;
}
[IntegrationTest]
@@ -812,7 +812,7 @@ public class ReleasesClientTests
_github = Helper.GetAuthenticatedClient();
_releaseClient = _github.Repository.Release;
_context = _github.CreateRepositoryContext("public-repo").Result;
_context = _github.CreateRepositoryContextWithAutoInit("public-repo").Result;
}
[IntegrationTest]
@@ -867,7 +867,7 @@ public class ReleasesClientTests
_github = Helper.GetAuthenticatedClient();
_releaseClient = _github.Repository.Release;
_context = _github.CreateRepositoryContext("public-repo").Result;
_context = _github.CreateRepositoryContextWithAutoInit("public-repo").Result;
}
[IntegrationTest]

View File

@@ -511,7 +511,7 @@ public class RepositoriesClientTests
[IntegrationTest]
public async Task UpdatesNothing()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext())
{
var update = new RepositoryUpdate();
@@ -542,7 +542,7 @@ public class RepositoriesClientTests
[IntegrationTest]
public async Task UpdatesName()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext())
{
var updatedName = Helper.MakeNameWithTimestamp("updated-repo");
var update = new RepositoryUpdate() { Name = updatedName };
@@ -556,7 +556,7 @@ public class RepositoriesClientTests
[IntegrationTest]
public async Task UpdatesNameWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext())
{
var updatedName = Helper.MakeNameWithTimestamp("updated-repo");
var update = new RepositoryUpdate() { Name = updatedName };
@@ -570,7 +570,7 @@ public class RepositoriesClientTests
[IntegrationTest]
public async Task UpdatesNameObsolete()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext())
{
var updatedName = Helper.MakeNameWithTimestamp("updated-repo");
var update = new RepositoryUpdate(updatedName);
@@ -584,7 +584,7 @@ public class RepositoriesClientTests
[IntegrationTest]
public async Task UpdatesNameWithRepositoryIdObsolete()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext())
{
var updatedName = Helper.MakeNameWithTimestamp("updated-repo");
var update = new RepositoryUpdate(updatedName);
@@ -598,7 +598,7 @@ public class RepositoriesClientTests
[IntegrationTest]
public async Task UpdatesDescription()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext())
{
var update = new RepositoryUpdate() { Description = "Updated description" };
@@ -611,7 +611,7 @@ public class RepositoriesClientTests
[IntegrationTest]
public async Task UpdatesDescriptionWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext())
{
var update = new RepositoryUpdate() { Description = "Updated description" };
@@ -624,7 +624,7 @@ public class RepositoriesClientTests
[IntegrationTest]
public async Task UpdatesHomepage()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext())
{
var update = new RepositoryUpdate() { Homepage = "http://aUrl.to/nowhere" };
@@ -637,7 +637,7 @@ public class RepositoriesClientTests
[IntegrationTest]
public async Task UpdatesHomepageWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext())
{
var update = new RepositoryUpdate() { Homepage = "http://aUrl.to/nowhere" };
@@ -650,7 +650,7 @@ public class RepositoriesClientTests
[PaidAccountTest]
public async Task UpdatesPrivate()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext())
{
var update = new RepositoryUpdate() { Private = true };
@@ -663,7 +663,7 @@ public class RepositoriesClientTests
[PaidAccountTest]
public async Task UpdatesPrivateWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext())
{
var update = new RepositoryUpdate() { Private = true };
@@ -676,7 +676,7 @@ public class RepositoriesClientTests
[IntegrationTest]
public async Task UpdatesHasIssues()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext())
{
var update = new RepositoryUpdate() { HasIssues = false };
@@ -689,7 +689,7 @@ public class RepositoriesClientTests
[IntegrationTest]
public async Task UpdatesHasIssuesWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext())
{
var update = new RepositoryUpdate() { HasIssues = false };
@@ -702,7 +702,7 @@ public class RepositoriesClientTests
[IntegrationTest]
public async Task UpdatesHasWiki()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext())
{
var update = new RepositoryUpdate() { HasWiki = false };
@@ -715,7 +715,7 @@ public class RepositoriesClientTests
[IntegrationTest]
public async Task UpdatesHasWikiWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext())
{
var update = new RepositoryUpdate() { HasWiki = false };
@@ -728,7 +728,7 @@ public class RepositoriesClientTests
[IntegrationTest]
public async Task UpdatesHasDownloads()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext())
{
var update = new RepositoryUpdate() { HasDownloads = false };
@@ -741,7 +741,7 @@ public class RepositoriesClientTests
[IntegrationTest]
public async Task UpdatesHasDownloadsWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext())
{
var update = new RepositoryUpdate() { HasDownloads = false };
@@ -754,7 +754,7 @@ public class RepositoriesClientTests
[IntegrationTest]
public async Task UpdatesIsTemplate()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext())
{
var update = new RepositoryUpdate() { IsTemplate = true };
@@ -767,7 +767,7 @@ public class RepositoriesClientTests
[IntegrationTest]
public async Task UpdatesIsTemplateWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext())
{
var update = new RepositoryUpdate() { IsTemplate = true };
@@ -780,7 +780,7 @@ public class RepositoriesClientTests
[IntegrationTest]
public async Task UpdatesDefaultBranch()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext())
{
var reference = _github.Git.Reference.GetAll(repoContext.RepositoryOwner, repoContext.RepositoryName).Result.First();
_github.Git.Reference.Create(repoContext.RepositoryId, new NewReference("refs/heads/primary", reference.Object.Sha)).Wait();
@@ -795,7 +795,7 @@ public class RepositoriesClientTests
[IntegrationTest]
public async Task UpdatesDefaultBranchWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext())
{
var reference = _github.Git.Reference.GetAll(repoContext.RepositoryOwner, repoContext.RepositoryName).Result.First();
_github.Git.Reference.Create(repoContext.RepositoryId, new NewReference("refs/heads/primary", reference.Object.Sha)).Wait();
@@ -810,9 +810,8 @@ public class RepositoriesClientTests
[IntegrationTest]
public async Task UpdatesMergeMethod()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext())
{
var updateRepository = new RepositoryUpdate()
{
AllowMergeCommit = false,
@@ -832,7 +831,7 @@ public class RepositoriesClientTests
[IntegrationTest]
public async Task UpdatesMergeMethodWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext())
{
var updateRepository = new RepositoryUpdate()
{
@@ -849,23 +848,26 @@ public class RepositoriesClientTests
Assert.True(editedRepository.AllowAutoMerge);
}
}
[IntegrationTest]
public async Task UpdatesDeleteBranchOnMergeMethod()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext())
{
var updateRepository = new RepositoryUpdate() { DeleteBranchOnMerge = true };
var editedRepository = await _github.Repository.Edit(repoContext.RepositoryOwner, repoContext.RepositoryName, updateRepository);
Assert.True(editedRepository.DeleteBranchOnMerge);
var repository = await _github.Repository.Get(repoContext.RepositoryOwner, repoContext.RepositoryName);
Assert.True(repository.DeleteBranchOnMerge);
}
}
[IntegrationTest]
public async Task UpdatesDeleteBranchOnMergeMethodWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext())
{
var updateRepository = new RepositoryUpdate() { DeleteBranchOnMerge = true };
@@ -877,7 +879,7 @@ public class RepositoriesClientTests
[IntegrationTest]
public async Task UpdatesArchive()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext())
{
var update = new RepositoryUpdate() { Archived = true };
@@ -890,7 +892,7 @@ public class RepositoriesClientTests
[IntegrationTest]
public async Task UpdatesArchiveWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext())
{
var update = new RepositoryUpdate() { Archived = true };
@@ -928,9 +930,10 @@ public class RepositoriesClientTests
}
}
public class TheGetMethod
public class TheGetMethod : GitHubClientTestBase
{
[IntegrationTest]
[PotentiallyFlakyTest]
public async Task ReturnsSpecifiedRepository()
{
var github = Helper.GetAuthenticatedClient();
@@ -945,6 +948,7 @@ public class RepositoriesClientTests
}
[IntegrationTest]
[PotentiallyFlakyTest]
public async Task ReturnsSpecifiedRepositoryWithRepositoryId()
{
var github = Helper.GetAuthenticatedClient();
@@ -959,6 +963,7 @@ public class RepositoriesClientTests
}
[IntegrationTest]
[PotentiallyFlakyTest]
public async Task ReturnsOrganizationRepository()
{
var github = Helper.GetAuthenticatedClient();
@@ -972,6 +977,7 @@ public class RepositoriesClientTests
}
[IntegrationTest]
[PotentiallyFlakyTest]
public async Task ReturnsRenamedRepository()
{
var github = Helper.GetAuthenticatedClient();
@@ -997,6 +1003,7 @@ public class RepositoriesClientTests
}
[IntegrationTest]
[PotentiallyFlakyTest]
public async Task ReturnsOrganizationRepositoryWithRepositoryId()
{
var github = Helper.GetAuthenticatedClient();
@@ -1010,6 +1017,7 @@ public class RepositoriesClientTests
}
[IntegrationTest]
[PotentiallyFlakyTest]
public async Task ReturnsForkedRepository()
{
var github = Helper.GetAuthenticatedClient();
@@ -1021,6 +1029,7 @@ public class RepositoriesClientTests
}
[IntegrationTest]
[PotentiallyFlakyTest]
public async Task ReturnsForkedRepositoryWithRepositoryId()
{
var github = Helper.GetAuthenticatedClient();
@@ -1036,7 +1045,7 @@ public class RepositoriesClientTests
{
var github = Helper.GetAuthenticatedClient();
using (var context = await github.CreateRepositoryContext(Helper.MakeNameWithTimestamp("public-repo")))
using (var context = await github.CreateUserRepositoryContext(Helper.MakeNameWithTimestamp("public-repo")))
{
var repository = await github.Repository.Get(context.RepositoryOwner, context.RepositoryName);
@@ -1052,7 +1061,7 @@ public class RepositoriesClientTests
{
var github = Helper.GetAuthenticatedClient();
using (var context = await github.CreateRepositoryContext(Helper.MakeNameWithTimestamp("public-repo")))
using (var context = await github.CreateUserRepositoryContext(Helper.MakeNameWithTimestamp("public-repo")))
{
var repository = await github.Repository.Get(context.RepositoryId);
@@ -1064,6 +1073,7 @@ public class RepositoriesClientTests
}
[IntegrationTest]
[PotentiallyFlakyTest]
public async Task ReturnsSpecifiedRepositoryWithLicenseInformation()
{
var github = Helper.GetAuthenticatedClient();
@@ -1074,13 +1084,13 @@ public class RepositoriesClientTests
Assert.Equal("mit", repository.License.Key);
Assert.Equal("MIT License", repository.License.Name);
}
[IntegrationTest]
public async Task ReturnsRepositoryDeleteBranchOnMergeOptions()
{
var github = Helper.GetAuthenticatedClient();
using (var context = await github.CreateRepositoryContext(Helper.MakeNameWithTimestamp("public-repo")))
using (var context = await github.CreateUserRepositoryContext(Helper.MakeNameWithTimestamp("public-repo")))
{
var repository = await github.Repository.Get(context.RepositoryOwner, context.RepositoryName);
@@ -1093,7 +1103,7 @@ public class RepositoriesClientTests
{
var github = Helper.GetAuthenticatedClient();
using (var context = await github.CreateRepositoryContext(Helper.MakeNameWithTimestamp("public-repo")))
using (var context = await github.CreateUserRepositoryContext(Helper.MakeNameWithTimestamp("public-repo")))
{
var repository = await github.Repository.Get(context.RepositoryId);
@@ -1632,7 +1642,7 @@ public class RepositoriesClientTests
}
}
public class TheGetAllLanguagesMethod
public class TheGetAllLanguagesMethod : GitHubClientTestBase
{
[IntegrationTest]
public async Task GetsLanguages()
@@ -1660,7 +1670,7 @@ public class RepositoriesClientTests
public async Task GetsEmptyLanguagesWhenNone()
{
var github = Helper.GetAuthenticatedClient();
using (var context = await github.CreateRepositoryContext(Helper.MakeNameWithTimestamp("public-repo")))
using (var context = await github.CreateUserRepositoryContext(Helper.MakeNameWithTimestamp("public-repo")))
{
var languages = await github.Repository.GetAllLanguages(context.RepositoryOwner, context.RepositoryName);
@@ -1672,7 +1682,7 @@ public class RepositoriesClientTests
public async Task GetsEmptyLanguagesWhenNoneWithRepositoryId()
{
var github = Helper.GetAuthenticatedClient();
using (var context = await github.CreateRepositoryContext(Helper.MakeNameWithTimestamp("public-repo")))
using (var context = await github.CreateUserRepositoryContext(Helper.MakeNameWithTimestamp("public-repo")))
{
var languages = await github.Repository.GetAllLanguages(context.RepositoryId);
@@ -2250,49 +2260,4 @@ public class RepositoriesClientTests
Assert.True(enabled);
}
}
public class RepositoryTestBaseClass : IDisposable
{
protected IGitHubClient _github;
private readonly List<RepositoryContext> _repositories;
protected RepositoryTestBaseClass()
{
_github = Helper.GetAuthenticatedClient();
_repositories = new List<RepositoryContext>();
}
public void Dispose()
{
foreach (var repository in _repositories)
{
repository.Dispose();
}
}
/// <summary>
/// Returns a RepositoryContext, which will be disposed at the end of the test.
/// </summary>
/// <param name="name">Your value or uses default of Helper.MakeNameWithTimestamp("public-repo");</param>
/// <returns></returns>
internal RepositoryContext CreateRepository(string name = null)
{
var newContext = _github.CreateRepositoryContext(new NewRepository(Helper.MakeNameWithTimestamp(name ?? Helper.MakeNameWithTimestamp("public-repo"))) { AutoInit = true }).Result;
_repositories.Add(newContext);
return newContext;
}
/// <summary>
/// Returns a RepositoryContext, which will be disposed at the end of the test.
/// </summary>
/// <param name="name">Your value or uses default of Helper.MakeNameWithTimestamp("public-repo");</param>
/// <returns></returns>
internal async Task<RepositoryContext> CreateRepositoryAsync(string name = null)
{
var newContext = await _github.CreateRepositoryContext(new NewRepository(Helper.MakeNameWithTimestamp(name ?? Helper.MakeNameWithTimestamp("public-repo"))) { AutoInit = true });
_repositories.Add(newContext);
return newContext;
}
}
}

View File

@@ -14,7 +14,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task GetsAllBranches()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.Git.Reference.CreateBranch(repoContext.RepositoryOwner, repoContext.RepositoryName, "patch-1", repoContext.Repository.DefaultBranch);
await _github.Git.Reference.CreateBranch(repoContext.RepositoryOwner, repoContext.RepositoryName, "patch-2", repoContext.Repository.DefaultBranch);
@@ -29,7 +29,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task GetsAllBranchesWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.Git.Reference.CreateBranch(repoContext.RepositoryOwner, repoContext.RepositoryName, "patch-1", repoContext.Repository.DefaultBranch);
await _github.Git.Reference.CreateBranch(repoContext.RepositoryOwner, repoContext.RepositoryName, "patch-2", repoContext.Repository.DefaultBranch);
@@ -44,7 +44,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task ReturnsCorrectCountOfBranchesWithoutStart()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.Git.Reference.CreateBranch(repoContext.RepositoryOwner, repoContext.RepositoryName, "patch-1", repoContext.Repository.DefaultBranch);
await _github.Git.Reference.CreateBranch(repoContext.RepositoryOwner, repoContext.RepositoryName, "patch-2", repoContext.Repository.DefaultBranch);
@@ -71,7 +71,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task ReturnsCorrectCountOfBranchesWithoutStartWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.Git.Reference.CreateBranch(repoContext.RepositoryOwner, repoContext.RepositoryName, "patch-1", repoContext.Repository.DefaultBranch);
await _github.Git.Reference.CreateBranch(repoContext.RepositoryOwner, repoContext.RepositoryName, "patch-2", repoContext.Repository.DefaultBranch);
@@ -98,7 +98,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task ReturnsCorrectCountOfBranchesWithStart()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.Git.Reference.CreateBranch(repoContext.RepositoryOwner, repoContext.RepositoryName, "patch-1", repoContext.Repository.DefaultBranch);
await _github.Git.Reference.CreateBranch(repoContext.RepositoryOwner, repoContext.RepositoryName, "patch-2", repoContext.Repository.DefaultBranch);
@@ -126,7 +126,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task ReturnsCorrectCountOfBranchesWithStartWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.Git.Reference.CreateBranch(repoContext.RepositoryOwner, repoContext.RepositoryName, "patch-1", repoContext.Repository.DefaultBranch);
await _github.Git.Reference.CreateBranch(repoContext.RepositoryOwner, repoContext.RepositoryName, "patch-2", repoContext.Repository.DefaultBranch);
@@ -154,7 +154,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task GetsPagesOfBranches()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.Git.Reference.CreateBranch(repoContext.RepositoryOwner, repoContext.RepositoryName, "patch-1", repoContext.Repository.DefaultBranch);
await _github.Git.Reference.CreateBranch(repoContext.RepositoryOwner, repoContext.RepositoryName, "patch-2", repoContext.Repository.DefaultBranch);
@@ -198,7 +198,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task GetsPagesOfBranchesWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.Git.Reference.CreateBranch(repoContext.RepositoryOwner, repoContext.RepositoryName, "patch-1", repoContext.Repository.DefaultBranch);
await _github.Git.Reference.CreateBranch(repoContext.RepositoryOwner, repoContext.RepositoryName, "patch-2", repoContext.Repository.DefaultBranch);
@@ -245,7 +245,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task GetsABranch()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -261,7 +261,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task GetsABranchWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -280,7 +280,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task GetsBranchProtection()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -307,7 +307,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task GetsBranchProtectionWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -334,7 +334,7 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task GetsBranchProtectionForOrgRepo()
{
using (var repoContext = await _github.CreateOrganizationRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranchWithTeam(repoContext);
@@ -358,7 +358,7 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task GetsBranchProtectionForOrgRepoWithRepositoryId()
{
using (var repoContext = await _github.CreateOrganizationRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranchWithTeam(repoContext);
@@ -385,7 +385,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task UpdatesBranchProtection()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -413,7 +413,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task UpdatesBranchProtectionWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -441,7 +441,7 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task UpdatesBranchProtectionForOrgRepo()
{
using (var repoContext = await _github.CreateOrganizationRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranchWithTeam(repoContext);
@@ -471,7 +471,7 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task UpdatesBranchProtectionForOrgRepoWithRepositoryId()
{
using (var repoContext = await _github.CreateOrganizationRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranchWithTeam(repoContext);
var update = new BranchProtectionSettingsUpdate(
@@ -503,7 +503,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task DeletesBranchProtection()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -516,7 +516,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task DeletesBranchProtectionWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -529,7 +529,7 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task DeletesBranchProtectionForOrgRepo()
{
using (var repoContext = await _github.CreateOrganizationRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranchWithTeam(repoContext);
@@ -542,7 +542,7 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task DeletesBranchProtectionForOrgRepoWithRepositoryId()
{
using (var repoContext = await _github.CreateOrganizationRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranchWithTeam(repoContext);
@@ -558,7 +558,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task GetsRequiredStatusChecks()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
var requiredStatusChecks = await _github.Repository.Branch.GetRequiredStatusChecks(repoContext.RepositoryOwner, repoContext.RepositoryName, repoContext.RepositoryDefaultBranch);
@@ -573,7 +573,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task GetsRequiredStatusChecksWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
var requiredStatusChecks = await _github.Repository.Branch.GetRequiredStatusChecks(repoContext.RepositoryId, repoContext.RepositoryDefaultBranch);
@@ -591,7 +591,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task UpdateRequiredStatusChecks()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -609,7 +609,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task UpdatesRequiredStatusChecksWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -630,7 +630,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task DeletesRequiredStatusChecks()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -643,7 +643,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task DeletesRequiredStatusChecksWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -659,7 +659,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task GetsRequiredStatusChecksContexts()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -673,7 +673,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task GetsRequiredStatusChecksContextsWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -690,7 +690,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task UpdateRequiredStatusChecksContexts()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -704,7 +704,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task UpdatesRequiredStatusChecksContextsWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -721,7 +721,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task AddsRequiredStatusChecksContexts()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -736,7 +736,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task AddsRequiredStatusChecksContextsWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -754,7 +754,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task DeletesRequiredStatusChecksContexts()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -769,7 +769,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task DeletesRequiredStatusChecksContextsWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -787,7 +787,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task GetsReviewEnforcement()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -802,7 +802,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task GetsReviewEnforcementWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -817,7 +817,7 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task GetsReviewEnforcementForOrgRepo()
{
using (var repoContext = await _github.CreateOrganizationRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranchWithTeam(repoContext);
@@ -833,7 +833,7 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task GetsReviewEnforcementForOrgRepoWithRepositoryId()
{
using (var repoContext = await _github.CreateOrganizationRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranchWithTeam(repoContext);
@@ -852,7 +852,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task UpdatesReviewEnforcement()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -870,7 +870,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task UpdatesReviewEnforcementWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -888,7 +888,7 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task UpdatesReviewEnforcementForOrgRepo()
{
using (var repoContext = await _github.CreateOrganizationRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranchWithTeam(repoContext);
@@ -910,7 +910,7 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task UpdatesReviewEnforcementForOrgRepoWithRepositoryId()
{
using (var repoContext = await _github.CreateOrganizationRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranchWithTeam(repoContext);
@@ -932,7 +932,7 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task UpdatesReviewEnforcementForOrgRepoWithAdminOnly()
{
using (var repoContext = await _github.CreateOrganizationRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranchWithTeam(repoContext);
@@ -955,7 +955,7 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task UpdatesReviewEnforcementForOrgRepoWithAdminOnlyWithRepositoryId()
{
using (var repoContext = await _github.CreateOrganizationRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranchWithTeam(repoContext);
@@ -981,7 +981,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task RemovesReviewEnforcement()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -994,7 +994,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task RemovesReviewEnforcementWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -1007,7 +1007,7 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task RemovesReviewEnforcementForOrgRepo()
{
using (var repoContext = await _github.CreateOrganizationRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranchWithTeam(repoContext);
@@ -1020,7 +1020,7 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task RemovesReviewEnforcementForOrgRepoWithRepositoryId()
{
using (var repoContext = await _github.CreateOrganizationRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranchWithTeam(repoContext);
@@ -1036,7 +1036,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task GetsAdminEnforcement()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -1050,7 +1050,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task GetsAdminEnforcementWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -1067,7 +1067,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task AddsAdminEnforcement()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -1082,7 +1082,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task AddsAdminEnforcementoWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -1100,7 +1100,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task RemovesAdminEnforcement()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -1118,7 +1118,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task RemovesAdminEnforcementWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateUserRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
@@ -1137,11 +1137,11 @@ namespace Octokit.Tests.Integration.Clients
public class TheGetProtectedBranchRestrictionsMethod : GitHubClientTestBase
{
[OrganizationTest]
public async Task GetsRequirProtectedBranchRestrictionsForOrgRepo()
public async Task GetsProtectedBranchRestrictionsForOrgRepo()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
await _github.ProtectDefaultBranchWithTeam(repoContext);
var restrictions = await _github.Repository.Branch.GetProtectedBranchRestrictions(repoContext.RepositoryOwner, repoContext.RepositoryName, repoContext.RepositoryDefaultBranch);
@@ -1153,9 +1153,9 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task GetsProtectedBranchRestrictionsForOrgRepoWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
await _github.ProtectDefaultBranchWithTeam(repoContext);
var restrictions = await _github.Repository.Branch.GetProtectedBranchRestrictions(repoContext.RepositoryId, repoContext.RepositoryDefaultBranch);
@@ -1170,9 +1170,9 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task DeletesRProtectedBranchRestrictionsForOrgRepo()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
await _github.ProtectDefaultBranchWithTeam(repoContext);
var deleted = await _github.Repository.Branch.DeleteProtectedBranchRestrictions(repoContext.RepositoryOwner, repoContext.RepositoryName, repoContext.RepositoryDefaultBranch);
@@ -1183,9 +1183,9 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task DeletesProtectedBranchRestrictionsForOrgRepoWithRepositoryId()
{
using (var repoContext = await _github.CreateRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranch(repoContext);
await _github.ProtectDefaultBranchWithTeam(repoContext);
var deleted = await _github.Repository.Branch.DeleteProtectedBranchRestrictions(repoContext.RepositoryId, repoContext.RepositoryDefaultBranch);
@@ -1199,7 +1199,7 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task GetsProtectedBranchTeamRestrictionsForOrgRepo()
{
using (var repoContext = await _github.CreateOrganizationRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranchWithTeam(repoContext);
@@ -1213,7 +1213,7 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task GetsProtectedBranchTeamRestrictionsForOrgRepoWithRepositoryId()
{
using (var repoContext = await _github.CreateOrganizationRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranchWithTeam(repoContext);
@@ -1230,7 +1230,7 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task UpdatesProtectedBranchTeamRestrictionsForOrgRepo()
{
using (var repoContext = await _github.CreateOrganizationRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranchWithTeam(repoContext);
@@ -1254,7 +1254,7 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task UpdatesProtectedBranchTeamRestrictionsForOrgRepoWithRepositoryId()
{
using (var repoContext = await _github.CreateOrganizationRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranchWithTeam(repoContext);
@@ -1281,7 +1281,7 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task AddsProtectedBranchTeamRestrictionsForOrgRepo()
{
using (var repoContext = await _github.CreateOrganizationRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranchWithTeam(repoContext);
@@ -1305,7 +1305,7 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task AddsProtectedBranchTeamRestrictionsForOrgRepoWithRepositoryId()
{
using (var repoContext = await _github.CreateOrganizationRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranchWithTeam(repoContext);
@@ -1332,7 +1332,7 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task DeletesRProtectedBranchTeamRestrictionsForOrgRepo()
{
using (var repoContext = await _github.CreateOrganizationRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
var team = await _github.ProtectDefaultBranchWithTeam(repoContext);
@@ -1347,7 +1347,7 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task DeletesProtectedBranchTeamRestrictionsForOrgRepoWithRepositoryId()
{
using (var repoContext = await _github.CreateOrganizationRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
var team = await _github.ProtectDefaultBranchWithTeam(repoContext);
@@ -1365,7 +1365,7 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task GetsProtectedBranchUserRestrictionsForOrgRepo()
{
using (var repoContext = await _github.CreateOrganizationRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranchWithTeam(repoContext);
@@ -1379,7 +1379,7 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task GetsProtectedBranchUserRestrictionsForOrgRepoWithRepositoryId()
{
using (var repoContext = await _github.CreateOrganizationRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranchWithTeam(repoContext);
@@ -1396,7 +1396,7 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task UpdatesProtectedBranchUserRestrictionsForOrgRepo()
{
using (var repoContext = await _github.CreateOrganizationRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranchWithTeam(repoContext);
@@ -1412,7 +1412,7 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task UpdatesProtectedBranchUserRestrictionsForOrgRepoWithRepositoryId()
{
using (var repoContext = await _github.CreateOrganizationRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranchWithTeam(repoContext);
@@ -1431,7 +1431,7 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task AddsProtectedBranchUserRestrictionsForOrgRepo()
{
using (var repoContext = await _github.CreateOrganizationRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
var team = await _github.ProtectDefaultBranchWithTeam(repoContext);
@@ -1447,7 +1447,7 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task AddsProtectedBranchUserRestrictionsForOrgRepoWithRepositoryId()
{
using (var repoContext = await _github.CreateOrganizationRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranchWithTeam(repoContext);
@@ -1466,7 +1466,7 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task DeletesProtectedBranchUserRestrictionsForOrgRepo()
{
using (var repoContext = await _github.CreateOrganizationRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranchWithTeam(repoContext);
@@ -1486,7 +1486,7 @@ namespace Octokit.Tests.Integration.Clients
[OrganizationTest]
public async Task DeletesProtectedBranchUserRestrictionsForOrgRepoWithRepositoryId()
{
using (var repoContext = await _github.CreateOrganizationRepositoryContext())
using (var repoContext = await _github.CreateOrganizationRepositoryContext(x => x.AutoInit = true))
{
await _github.ProtectDefaultBranchWithTeam(repoContext);

View File

@@ -41,7 +41,7 @@ public class RepositoryCommentsClientTests
[IntegrationTest]
public async Task CanGetReactionPayload()
{
using (var context = await _github.CreateRepositoryContext(Helper.MakeNameWithTimestamp("CommitCommentsReactionTests")))
using (var context = await _github.CreateRepositoryContextWithAutoInit(Helper.MakeNameWithTimestamp("CommitCommentsReactionTests")))
{
// Create a test commit
var commit = await HelperCreateCommit(context.RepositoryOwner, context.RepositoryName);
@@ -204,7 +204,7 @@ public class RepositoryCommentsClientTests
public async Task CanGetReactionPayload()
{
var numberToCreate = 2;
using (var context = await _github.CreateRepositoryContext(Helper.MakeNameWithTimestamp("CommitCommentsReactionTests")))
using (var context = await _github.CreateRepositoryContextWithAutoInit(Helper.MakeNameWithTimestamp("CommitCommentsReactionTests")))
{
var commentIds = new List<int>();
@@ -379,7 +379,7 @@ public class RepositoryCommentsClientTests
public async Task CanGetReactionPayload()
{
var numberToCreate = 2;
using (var context = await _github.CreateRepositoryContext(Helper.MakeNameWithTimestamp("CommitCommentsReactionTests")))
using (var context = await _github.CreateRepositoryContextWithAutoInit(Helper.MakeNameWithTimestamp("CommitCommentsReactionTests")))
{
var commentIds = new List<int>();
@@ -423,7 +423,7 @@ public class RepositoryCommentsClientTests
public TheCreateMethod()
{
_github = Helper.GetAuthenticatedClient();
_context = _github.CreateRepositoryContext("public-repo").Result;
_context = _github.CreateRepositoryContextWithAutoInit("public-repo").Result;
}
private async Task<Commit> SetupCommitForRepository(IGitHubClient client)
@@ -532,7 +532,7 @@ public class RepositoryCommentsClientTests
{
_github = Helper.GetAuthenticatedClient();
_context = _github.CreateRepositoryContext("public-repo").Result;
_context = _github.CreateRepositoryContextWithAutoInit("public-repo").Result;
}
private async Task<Commit> SetupCommitForRepository(IGitHubClient client)
@@ -621,7 +621,7 @@ public class RepositoryCommentsClientTests
{
_github = Helper.GetAuthenticatedClient();
_context = _github.CreateRepositoryContext("public-repo").Result;
_context = _github.CreateRepositoryContextWithAutoInit("public-repo").Result;
}
private async Task<Commit> SetupCommitForRepository(IGitHubClient client)

View File

@@ -285,7 +285,7 @@ public class RepositoryCommitsClientTests
[IntegrationTest]
public async Task CanGetSha1()
{
var sha1 = await _fixture.GetSha1(octokitNetRepositoryOwner, octokitNetRepositorName, "master");
var sha1 = await _fixture.GetSha1(octokitNetRepositoryOwner, octokitNetRepositorName, "main");
Assert.NotNull(sha1);
}
@@ -293,7 +293,7 @@ public class RepositoryCommitsClientTests
[IntegrationTest]
public async Task CanGetSha1WithRepositoryId()
{
var sha1 = await _fixture.GetSha1(octokitNetRepositoryId, "master");
var sha1 = await _fixture.GetSha1(octokitNetRepositoryId, "main");
Assert.NotNull(sha1);
}
@@ -311,7 +311,7 @@ public class RepositoryCommitsClientTests
_fixture = _github.Repository.Commit;
_context = _github.CreateRepositoryContext("source-repo").Result;
_context = _github.CreateRepositoryContextWithAutoInit("source-repo").Result;
}
[IntegrationTest]
@@ -319,7 +319,7 @@ public class RepositoryCommitsClientTests
{
await CreateTheWorld();
var result = await _fixture.Compare(Helper.UserName, _context.RepositoryName, "master", "my-branch");
var result = await _fixture.Compare(Helper.UserName, _context.RepositoryName, "main", "my-branch");
Assert.Equal(1, result.TotalCommits);
Assert.Equal(1, result.Commits.Count);
@@ -332,7 +332,7 @@ public class RepositoryCommitsClientTests
{
await CreateTheWorld();
var result = await _fixture.Compare(_context.Repository.Id, "master", "my-branch");
var result = await _fixture.Compare(_context.Repository.Id, "main", "my-branch");
Assert.Equal(1, result.TotalCommits);
Assert.Equal(1, result.Commits.Count);
@@ -345,7 +345,7 @@ public class RepositoryCommitsClientTests
{
await CreateTheWorld();
var result = await _fixture.Compare(Helper.UserName, _context.RepositoryName, "my-branch", "master");
var result = await _fixture.Compare(Helper.UserName, _context.RepositoryName, "my-branch", "main");
Assert.Equal(0, result.TotalCommits);
Assert.Equal(0, result.Commits.Count);
@@ -358,7 +358,7 @@ public class RepositoryCommitsClientTests
{
await CreateTheWorld();
var result = await _fixture.Compare(_context.Repository.Id, "my-branch", "master");
var result = await _fixture.Compare(_context.Repository.Id, "my-branch", "main");
Assert.Equal(0, result.TotalCommits);
Assert.Equal(0, result.Commits.Count);
@@ -371,7 +371,7 @@ public class RepositoryCommitsClientTests
{
await CreateTheWorld();
var result = await _fixture.Compare(Helper.UserName, _context.RepositoryName, "my-branch", "master");
var result = await _fixture.Compare(Helper.UserName, _context.RepositoryName, "my-branch", "main");
Assert.NotNull(result.DiffUrl);
Assert.NotNull(result.HtmlUrl);
@@ -384,7 +384,7 @@ public class RepositoryCommitsClientTests
{
await CreateTheWorld();
var result = await _fixture.Compare(_context.Repository.Id, "my-branch", "master");
var result = await _fixture.Compare(_context.Repository.Id, "my-branch", "main");
Assert.NotNull(result.DiffUrl);
Assert.NotNull(result.HtmlUrl);
@@ -397,10 +397,10 @@ public class RepositoryCommitsClientTests
{
await CreateTheWorld();
var master = await _github.Git.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/master");
var main = await _github.Git.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/main");
var branch = await _github.Git.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/my-branch");
var result = await _fixture.Compare(Helper.UserName, _context.RepositoryName, master.Object.Sha, branch.Object.Sha);
var result = await _fixture.Compare(Helper.UserName, _context.RepositoryName, main.Object.Sha, branch.Object.Sha);
Assert.Equal(1, result.Commits.Count);
Assert.Equal(1, result.AheadBy);
@@ -412,10 +412,10 @@ public class RepositoryCommitsClientTests
{
await CreateTheWorld();
var master = await _github.Git.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/master");
var main = await _github.Git.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/main");
var branch = await _github.Git.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/my-branch");
var result = await _fixture.Compare(_context.Repository.Id, master.Object.Sha, branch.Object.Sha);
var result = await _fixture.Compare(_context.Repository.Id, main.Object.Sha, branch.Object.Sha);
Assert.Equal(1, result.Commits.Count);
Assert.Equal(1, result.AheadBy);
@@ -444,18 +444,18 @@ public class RepositoryCommitsClientTests
async Task<Reference> CreateTheWorld()
{
var master = await _github.Git.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/master");
var main = await _github.Git.Reference.Get(Helper.UserName, _context.RepositoryName, "heads/main");
// create new commit for master branch
var newMasterTree = await CreateTree(new Dictionary<string, string> { { "README.md", "Hello World!" } });
var newMaster = await CreateCommit("baseline for pull request", newMasterTree.Sha, master.Object.Sha);
// create new commit for main branch
var newMainTree = await CreateTree(new Dictionary<string, string> { { "README.md", "Hello World!" } });
var newMain = await CreateCommit("baseline for pull request", newMainTree.Sha, main.Object.Sha);
// update master
await _github.Git.Reference.Update(Helper.UserName, _context.RepositoryName, "heads/master", new ReferenceUpdate(newMaster.Sha));
// update main
await _github.Git.Reference.Update(Helper.UserName, _context.RepositoryName, "heads/main", new ReferenceUpdate(newMain.Sha));
// create new commit for feature branch
var featureBranchTree = await CreateTree(new Dictionary<string, string> { { "README.md", "I am overwriting this blob with something new" } });
var newFeature = await CreateCommit("this is the commit to merge into the pull request", featureBranchTree.Sha, newMaster.Sha);
var newFeature = await CreateCommit("this is the commit to merge into the pull request", featureBranchTree.Sha, newMain.Sha);
// create branch
return await _github.Git.Reference.Create(Helper.UserName, _context.RepositoryName, new NewReference("refs/heads/my-branch", newFeature.Sha));

View File

@@ -73,7 +73,7 @@ namespace Octokit.Tests.Integration.Clients
Assert.Equal(1, contents.Count);
Assert.Equal(ContentType.File, contents.First().Type);
Assert.Equal("https://github.com/octokit/octokit.net/blob/master/Octokit.Reactive/ObservableGitHubClient.cs", contents.First().HtmlUrl);
Assert.Equal("https://github.com/octokit/octokit.net/blob/main/Octokit.Reactive/ObservableGitHubClient.cs", contents.First().HtmlUrl);
}
[IntegrationTest]
@@ -88,7 +88,7 @@ namespace Octokit.Tests.Integration.Clients
Assert.Equal(1, contents.Count);
Assert.Equal(ContentType.File, contents.First().Type);
Assert.Equal("https://github.com/octokit/octokit.net/blob/master/Octokit.Reactive/ObservableGitHubClient.cs", contents.First().HtmlUrl);
Assert.Equal("https://github.com/octokit/octokit.net/blob/main/Octokit.Reactive/ObservableGitHubClient.cs", contents.First().HtmlUrl);
}
[IntegrationTest]
@@ -131,7 +131,7 @@ namespace Octokit.Tests.Integration.Clients
Assert.Equal(3, contents.Count);
Assert.Equal(ContentType.File, contents.First().Type);
Assert.Equal("https://github.com/octocat/Spoon-Knife/blob/master/README.md", contents.First().HtmlUrl);
Assert.Equal("https://github.com/octocat/Spoon-Knife/blob/main/README.md", contents.First().HtmlUrl);
}
[IntegrationTest]
@@ -146,7 +146,7 @@ namespace Octokit.Tests.Integration.Clients
Assert.Equal(3, contents.Count);
Assert.Equal(ContentType.File, contents.First().Type);
Assert.Equal("https://github.com/octocat/Spoon-Knife/blob/master/README.md", contents.First().HtmlUrl);
Assert.Equal("https://github.com/octocat/Spoon-Knife/blob/main/README.md", contents.First().HtmlUrl);
}
[IntegrationTest]
@@ -186,11 +186,11 @@ namespace Octokit.Tests.Integration.Clients
var contents = await github
.Repository
.Content
.GetAllContentsByRef("octokit", "octokit.net", "Octokit.Reactive/ObservableGitHubClient.cs", "master");
.GetAllContentsByRef("octokit", "octokit.net", "Octokit.Reactive/ObservableGitHubClient.cs", "main");
Assert.Equal(1, contents.Count);
Assert.Equal(ContentType.File, contents.First().Type);
Assert.Equal("https://github.com/octokit/octokit.net/blob/master/Octokit.Reactive/ObservableGitHubClient.cs", contents.First().HtmlUrl);
Assert.Equal("https://github.com/octokit/octokit.net/blob/main/Octokit.Reactive/ObservableGitHubClient.cs", contents.First().HtmlUrl);
}
[IntegrationTest]
@@ -201,11 +201,11 @@ namespace Octokit.Tests.Integration.Clients
var contents = await github
.Repository
.Content
.GetAllContentsByRef(7528679, "Octokit.Reactive/ObservableGitHubClient.cs", "master");
.GetAllContentsByRef(7528679, "Octokit.Reactive/ObservableGitHubClient.cs", "main");
Assert.Equal(1, contents.Count);
Assert.Equal(ContentType.File, contents.First().Type);
Assert.Equal("https://github.com/octokit/octokit.net/blob/master/Octokit.Reactive/ObservableGitHubClient.cs", contents.First().HtmlUrl);
Assert.Equal("https://github.com/octokit/octokit.net/blob/main/Octokit.Reactive/ObservableGitHubClient.cs", contents.First().HtmlUrl);
}
[IntegrationTest]
@@ -237,7 +237,7 @@ namespace Octokit.Tests.Integration.Clients
}
[IntegrationTest]
public async Task GetsContentNonMasterWithRootPath()
public async Task GetsContentNonMainWithRootPath()
{
var github = Helper.GetAuthenticatedClient();
@@ -256,7 +256,7 @@ namespace Octokit.Tests.Integration.Clients
var contents = await github
.Repository
.Content
.GetAllContentsByRef(7528679, "Octokit", "master");
.GetAllContentsByRef(7528679, "Octokit", "main");
Assert.True(contents.Count > 2);
Assert.Equal(ContentType.Dir, contents.First().Type);
@@ -270,11 +270,11 @@ namespace Octokit.Tests.Integration.Clients
var contents = await github
.Repository
.Content
.GetAllContentsByRef("octocat", "Spoon-Knife", "master");
.GetAllContentsByRef("octocat", "Spoon-Knife", "main");
Assert.Equal(3, contents.Count);
Assert.Equal(ContentType.File, contents.First().Type);
Assert.Equal("https://github.com/octocat/Spoon-Knife/blob/master/README.md", contents.First().HtmlUrl);
Assert.Equal("https://github.com/octocat/Spoon-Knife/blob/main/README.md", contents.First().HtmlUrl);
}
[IntegrationTest]
@@ -285,11 +285,11 @@ namespace Octokit.Tests.Integration.Clients
var contents = await github
.Repository
.Content
.GetAllContentsByRef(1300192, "master");
.GetAllContentsByRef(1300192, "main");
Assert.Equal(3, contents.Count);
Assert.Equal(ContentType.File, contents.First().Type);
Assert.Equal("https://github.com/octocat/Spoon-Knife/blob/master/README.md", contents.First().HtmlUrl);
Assert.Equal("https://github.com/octocat/Spoon-Knife/blob/main/README.md", contents.First().HtmlUrl);
}
[IntegrationTest]
@@ -300,7 +300,7 @@ namespace Octokit.Tests.Integration.Clients
var contents = await github
.Repository
.Content
.GetAllContentsByRef("octocat", "octocat.github.io", "master");
.GetAllContentsByRef("octocat", "octocat.github.io", "main");
Assert.NotEmpty(contents);
}
@@ -313,7 +313,7 @@ namespace Octokit.Tests.Integration.Clients
var contents = await github
.Repository
.Content
.GetAllContentsByRef(17881631, "master");
.GetAllContentsByRef(17881631, "main");
Assert.NotEmpty(contents);
}
@@ -416,8 +416,8 @@ namespace Octokit.Tests.Integration.Clients
{
var repository = context.Repository;
var master = await client.Git.Reference.Get(Helper.UserName, repository.Name, "heads/master");
await client.Git.Reference.Create(Helper.UserName, repository.Name, new NewReference("refs/heads/" + branchName, master.Object.Sha));
var main = await client.Git.Reference.Get(Helper.UserName, repository.Name, "heads/main");
await client.Git.Reference.Create(Helper.UserName, repository.Name, new NewReference("refs/heads/" + branchName, main.Object.Sha));
var file = await fixture.CreateFile(
repository.Owner.Login,
repository.Name,
@@ -463,8 +463,8 @@ namespace Octokit.Tests.Integration.Clients
{
var repository = context.Repository;
var master = await client.Git.Reference.Get(Helper.UserName, repository.Name, "heads/master");
await client.Git.Reference.Create(Helper.UserName, repository.Name, new NewReference("refs/heads/" + branchName, master.Object.Sha));
var main = await client.Git.Reference.Get(Helper.UserName, repository.Name, "heads/main");
await client.Git.Reference.Create(Helper.UserName, repository.Name, new NewReference("refs/heads/" + branchName, main.Object.Sha));
var file = await fixture.CreateFile(
repository.Id,
"somefile.txt",
@@ -592,8 +592,8 @@ namespace Octokit.Tests.Integration.Clients
{
var repository = context.Repository;
var master = await client.Git.Reference.Get(Helper.UserName, repository.Name, "heads/master");
await client.Git.Reference.Create(Helper.UserName, repository.Name, new NewReference("refs/heads/" + branchName, master.Object.Sha));
var main = await client.Git.Reference.Get(Helper.UserName, repository.Name, "heads/main");
await client.Git.Reference.Create(Helper.UserName, repository.Name, new NewReference("refs/heads/" + branchName, main.Object.Sha));
var file = await fixture.CreateFile(
repository.Owner.Login,
repository.Name,
@@ -639,8 +639,8 @@ namespace Octokit.Tests.Integration.Clients
{
var repository = context.Repository;
var master = await client.Git.Reference.Get(Helper.UserName, repository.Name, "heads/master");
await client.Git.Reference.Create(Helper.UserName, repository.Name, new NewReference("refs/heads/" + branchName, master.Object.Sha));
var main = await client.Git.Reference.Get(Helper.UserName, repository.Name, "heads/main");
await client.Git.Reference.Create(Helper.UserName, repository.Name, new NewReference("refs/heads/" + branchName, main.Object.Sha));
var file = await fixture.CreateFile(
repository.Id,
"somefile.txt",
@@ -733,7 +733,7 @@ namespace Octokit.Tests.Integration.Clients
var archive = await github
.Repository
.Content
.GetArchive("octocat", "Hello-World", ArchiveFormat.Tarball, "master");
.GetArchive("octocat", "Hello-World", ArchiveFormat.Tarball, "main");
Assert.NotEmpty(archive);
}
@@ -746,7 +746,7 @@ namespace Octokit.Tests.Integration.Clients
var archive = await github
.Repository
.Content
.GetArchive(1296269, ArchiveFormat.Tarball, "master"); // octocat/Hello-World repo
.GetArchive(1296269, ArchiveFormat.Tarball, "main"); // octocat/Hello-World repo
Assert.NotEmpty(archive);
}
@@ -759,7 +759,7 @@ namespace Octokit.Tests.Integration.Clients
var archive = await github
.Repository
.Content
.GetArchive("octocat", "Hello-World", ArchiveFormat.Tarball, "master", TimeSpan.FromMinutes(60));
.GetArchive("octocat", "Hello-World", ArchiveFormat.Tarball, "main", TimeSpan.FromMinutes(60));
Assert.NotEmpty(archive);
}
@@ -772,7 +772,7 @@ namespace Octokit.Tests.Integration.Clients
var archive = await github
.Repository
.Content
.GetArchive(1296269, ArchiveFormat.Tarball, "master", TimeSpan.FromMinutes(60)); // octocat/Hello-World repo
.GetArchive(1296269, ArchiveFormat.Tarball, "main", TimeSpan.FromMinutes(60)); // octocat/Hello-World repo
Assert.NotEmpty(archive);
}

View File

@@ -19,7 +19,7 @@ public class RepositoryDeployKeysClientTests : IDisposable
var github = Helper.GetAuthenticatedClient();
_fixture = github.Repository.DeployKeys;
_context = github.CreateRepositoryContext("public-repo").Result;
_context = github.CreateRepositoryContextWithAutoInit("public-repo").Result;
}
[IntegrationTest(Skip = "see https://github.com/octokit/octokit.net/issues/533 for investigating this failing test")]

View File

@@ -640,7 +640,7 @@ public class SearchClientTests
[IntegrationTest]
public async Task SearchForExcludedBase()
{
var branch = "master";
var branch = "main";
// Search for issues by target branch
var request = new SearchIssuesRequest();

View File

@@ -19,7 +19,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task CanCreateAndRetrieveContributors()
{
using (var context = await _client.CreateRepositoryContext("public-repo"))
using (var context = await _client.CreateRepositoryContextWithAutoInit("public-repo"))
{
var repository = new RepositorySummary(context);
await CommitToRepository(repository);
@@ -40,7 +40,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task CanCreateAndRetrieveContributorsWithRepositoryId()
{
using (var context = await _client.CreateRepositoryContext("public-repo"))
using (var context = await _client.CreateRepositoryContextWithAutoInit("public-repo"))
{
var repository = new RepositorySummary(context);
await CommitToRepository(repository);
@@ -88,7 +88,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task CanGetCommitActivityForTheLastYear()
{
using (var context = await _client.CreateRepositoryContext("public-repo"))
using (var context = await _client.CreateRepositoryContextWithAutoInit("public-repo"))
{
var repository = new RepositorySummary(context);
await CommitToRepository(repository);
@@ -106,7 +106,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task CanGetCommitActivityForTheLastYearWithRepositoryId()
{
using (var context = await _client.CreateRepositoryContext("public-repo"))
using (var context = await _client.CreateRepositoryContextWithAutoInit("public-repo"))
{
var repository = new RepositorySummary(context);
await CommitToRepository(repository);
@@ -124,7 +124,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task CanGetAdditionsAndDeletionsPerWeek()
{
using (var context = await _client.CreateRepositoryContext("public-repo"))
using (var context = await _client.CreateRepositoryContextWithAutoInit("public-repo"))
{
var repository = new RepositorySummary(context);
await CommitToRepository(repository);
@@ -137,7 +137,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task CanGetAdditionsAndDeletionsPerWeekWithRepositoryId()
{
using (var context = await _client.CreateRepositoryContext("public-repo"))
using (var context = await _client.CreateRepositoryContextWithAutoInit("public-repo"))
{
var repository = new RepositorySummary(context);
await CommitToRepository(repository);
@@ -151,7 +151,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task CanGetParticipationStatistics()
{
using (var context = await _client.CreateRepositoryContext("public-repo"))
using (var context = await _client.CreateRepositoryContextWithAutoInit("public-repo"))
{
var repository = new RepositorySummary(context);
await CommitToRepository(repository);
@@ -163,7 +163,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task CanGetParticipationStatisticsWithRepositoryId()
{
using (var context = await _client.CreateRepositoryContext("public-repo"))
using (var context = await _client.CreateRepositoryContextWithAutoInit("public-repo"))
{
var repository = new RepositorySummary(context);
await CommitToRepository(repository);
@@ -175,7 +175,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task CanGetPunchCardForRepository()
{
using (var context = await _client.CreateRepositoryContext("public-repo"))
using (var context = await _client.CreateRepositoryContextWithAutoInit("public-repo"))
{
var repository = new RepositorySummary(context);
await CommitToRepository(repository);
@@ -188,7 +188,7 @@ namespace Octokit.Tests.Integration.Clients
[IntegrationTest]
public async Task CanGetPunchCardForRepositoryWithRepositoryId()
{
using (var context = await _client.CreateRepositoryContext("public-repo"))
using (var context = await _client.CreateRepositoryContextWithAutoInit("public-repo"))
{
var repository = new RepositorySummary(context);
await CommitToRepository(repository);

View File

@@ -17,7 +17,7 @@ namespace Octokit.Tests.Integration.Clients
var github = Helper.GetAuthenticatedClient();
fixture = github.Git.Tag;
context = github.CreateRepositoryContext("public-repo").Result;
context = github.CreateRepositoryContextWithAutoInit("public-repo").Result;
var blob = new NewBlob
{
@@ -65,7 +65,7 @@ namespace Octokit.Tests.Integration.Clients
var github = Helper.GetAuthenticatedClient();
fixture = github.Git.Tag;
context = github.CreateRepositoryContext("public-repo").Result;
context = github.CreateRepositoryContextWithAutoInit("public-repo").Result;
var blob = new NewBlob
{

View File

@@ -17,7 +17,7 @@ public class TreeClientTests : IDisposable
_fixture = _github.Git.Tree;
_context = _github.CreateRepositoryContext("public-repo").Result;
_context = _github.CreateRepositoryContextWithAutoInit("public-repo").Result;
}
[IntegrationTest]
@@ -73,7 +73,7 @@ public class TreeClientTests : IDisposable
[IntegrationTest]
public async Task CanGetATree()
{
var result = await _fixture.Get("octokit", "octokit.net", "master");
var result = await _fixture.Get("octokit", "octokit.net", "main");
Assert.NotNull(result);
Assert.NotEmpty(result.Tree);
@@ -82,7 +82,7 @@ public class TreeClientTests : IDisposable
[IntegrationTest]
public async Task CanGetATreeWithRepositoryId()
{
var result = await _fixture.Get(1, "master");
var result = await _fixture.Get(1, "main");
Assert.NotNull(result);
Assert.NotEmpty(result.Tree);

View File

@@ -299,7 +299,7 @@ namespace Octokit.Tests.Integration.Clients
_watchingClient = github.Activity.Watching;
_context = github.CreateRepositoryContext("public-repo").Result;
_context = github.CreateRepositoryContextWithAutoInit("public-repo").Result;
}
[IntegrationTest]

View File

@@ -247,6 +247,8 @@ namespace Octokit.Tests.Integration
return string.Concat(name, "-", DateTime.UtcNow.ToString("yyyyMMddhhmmssfff"));
}
public static bool IsNameTimestamped(string name) => name.Contains("-") && name.Substring(name.LastIndexOf("-")).Length == 18;
public static Stream LoadFixture(string fileName)
{
var key = "Octokit.Tests.Integration.fixtures." + fileName;

View File

@@ -1,26 +1,24 @@
using System.Threading.Tasks;
using System;
using System.Threading.Tasks;
namespace Octokit.Tests.Integration.Helpers
{
internal static class GithubClientExtensions
{
/// <summary>
/// Creates a public repository with the timestamped name public-repo
/// Creates a public repository with the timestamped name public-repo and autoinit true
/// </summary>
internal static async Task<RepositoryContext> CreateRepositoryContext(this IGitHubClient client)
internal static async Task<RepositoryContext> CreateRepositoryContextWithAutoInit(this IGitHubClient client)
{
var repoName = Helper.MakeNameWithTimestamp("public-repo");
var repo = await client.Repository.Create(new NewRepository(repoName) { AutoInit = true });
return new RepositoryContext(client.Connection, repo);
return await client.CreateUserRepositoryContext(x => x.AutoInit = true);
}
internal static async Task<RepositoryContext> CreateRepositoryContext(this IGitHubClient client, string repositoryName)
/// <summary>
/// Creates a public repository with the repository name passed in and autoinit true
/// </summary>
internal static async Task<RepositoryContext> CreateRepositoryContextWithAutoInit(this IGitHubClient client, string repositoryName)
{
var repoName = Helper.MakeNameWithTimestamp(repositoryName);
var repo = await client.Repository.Create(new NewRepository(repoName) { AutoInit = true });
return new RepositoryContext(client.Connection, repo);
return await client.CreateUserRepositoryContext(Helper.MakeNameWithTimestamp(repositoryName), x => x.AutoInit = true);
}
internal static async Task<RepositoryContext> CreateRepositoryContext(this IGitHubClient client, NewRepository newRepository)
@@ -31,9 +29,69 @@ namespace Octokit.Tests.Integration.Helpers
}
/// <summary>
/// Creates an organisationrepository with the timestamped name organisation-repo
/// Creates a public repository with the timestamped name "public-repo" and an optional function of parameters passed in
/// </summary>
internal static async Task<RepositoryContext> CreateOrganizationRepositoryContext(this IGitHubClient client)
/// <param name="client"></param>
/// <param name="repositoryName">The name of the repository without the timestamp</param>
/// <param name="action">Function setting parameters on the NewRepository</param>
/// <returns></returns>
internal static async Task<RepositoryContext> CreateUserRepositoryContext(this IGitHubClient client, Action<NewRepository> action = null)
{
var newRepository = new NewRepository(Helper.MakeNameWithTimestamp("public-repo"));
action?.Invoke(newRepository);
var repo = await client.Repository.Create(newRepository);
return new RepositoryContext(client.Connection, repo);
}
/// <summary>
/// Creates a public repository with the repository name and an optional function of parameters passed in
/// </summary>
/// <param name="client"></param>
/// <param name="repositoryName">The name of the repository without the timestamp</param>
/// <param name="action"></param>
/// <returns></returns>
internal static async Task<RepositoryContext> CreateUserRepositoryContext(this IGitHubClient client, string repositoryName, Action<NewRepository> action = null)
{
var newRepository = new NewRepository(Helper.IsNameTimestamped(repositoryName) ? repositoryName : Helper.MakeNameWithTimestamp(repositoryName));
action?.Invoke(newRepository);
var repo = await client.Repository.Create(newRepository);
return new RepositoryContext(client.Connection, repo);
}
/// <summary>
/// Creates an organisation repository with the timestamped name organisation-repo and an optional function of parameters
/// </summary>
internal static async Task<RepositoryContext> CreateOrganizationRepositoryContext(this IGitHubClient client, Action<NewRepository> action = null)
{
var newRepository = new NewRepository(Helper.MakeNameWithTimestamp("organization-repo"));
action?.Invoke(newRepository);
var repo = await client.Repository.Create(Helper.Organization, newRepository);
return new RepositoryContext(client.Connection, repo);
}
/// <summary>
/// Creates an organisation repository with the passed in repository name repo and an optional function of parameters
/// </summary>
internal static async Task<RepositoryContext> CreateOrganizationRepositoryContext(this IGitHubClient client, string repositoryName, Action<NewRepository> action = null)
{
var newRepository = new NewRepository(Helper.IsNameTimestamped(repositoryName) ? repositoryName : Helper.MakeNameWithTimestamp(repositoryName));
action?.Invoke(newRepository);
var repo = await client.Repository.Create(Helper.Organization, newRepository);
return new RepositoryContext(client.Connection, repo);
}
/// <summary>
/// Creates an organisation repository with the timestamped name organisation-repo
/// </summary>
internal static async Task<RepositoryContext> CreateOrganizationRepositoryContextWithAutoInit(this IGitHubClient client, Action<NewRepository> action = null)
{
var repoName = Helper.MakeNameWithTimestamp("organization-repo");
var repo = await client.Repository.Create(Helper.Organization, new NewRepository(repoName) { AutoInit = true });
@@ -51,6 +109,17 @@ namespace Octokit.Tests.Integration.Helpers
return new RepositoryContext(client.Connection, repo);
}
/// <summary>
/// Creates a private repository with the timestamped name private-repo
/// </summary>
internal static async Task<RepositoryContext> CreatePrivateRepositoryContext(this IGitHubClient client)
{
var repoName = Helper.MakeNameWithTimestamp("private-repo");
var repo = await client.Repository.Create(new NewRepository(repoName) { Private = true });
return new RepositoryContext(client.Connection, repo);
}
internal static async Task<RepositoryContext> Generate(this IGitHubClient client, string owner, string repoName, NewRepositoryFromTemplate newRepository)
{
var repo = await client.Repository.Generate(owner, repoName, newRepository);

View File

@@ -23,6 +23,14 @@ namespace Octokit.Tests.Integration
if (!Helper.IsPaidAccount)
return Enumerable.Empty<IXunitTestCase>();
var github = Helper.GetAuthenticatedClient();
var userDetails = github.User.Current().Result;
if (userDetails.Plan.PrivateRepos == 0)
{
return Enumerable.Empty<IXunitTestCase>();
}
return new[] { new XunitTestCase(diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), TestMethodDisplayOptions.None, testMethod) };
}
}

View File

@@ -13,11 +13,11 @@ namespace Octokit.Tests.Integration.Helpers
var client = Helper.GetAuthenticatedClient();
var fixture = client.Git.Reference;
using (var context = await client.CreateRepositoryContext("public-repo"))
using (var context = await client.CreateRepositoryContextWithAutoInit("public-repo"))
{
var branchFromMaster = await fixture.CreateBranch(context.RepositoryOwner, context.RepositoryName, "patch-1", context.Repository.DefaultBranch);
var branchFromMain = await fixture.CreateBranch(context.RepositoryOwner, context.RepositoryName, "patch-1", context.Repository.DefaultBranch);
var branchFromPath = await fixture.CreateBranch(context.RepositoryOwner, context.RepositoryName, "patch-2", branchFromMaster);
var branchFromPath = await fixture.CreateBranch(context.RepositoryOwner, context.RepositoryName, "patch-2", branchFromMain);
var allBranchNames = (await client.Repository.Branch.GetAll(context.RepositoryOwner, context.RepositoryName)).Select(b => b.Name);

View File

@@ -44,18 +44,18 @@ namespace Octokit.Tests.Integration.Helpers
public static async Task<Reference> CreateTheWorld(this IGitHubClient client, Repository repository)
{
var master = await client.Git.Reference.Get(repository.Owner.Login, repository.Name, "heads/master");
var main = await client.Git.Reference.Get(repository.Owner.Login, repository.Name, "heads/main");
// create new commit for master branch
var newMasterTree = await client.CreateTree(repository, new Dictionary<string, string> { { "README.md", "Hello World!" } });
var newMaster = await client.CreateCommit(repository, "baseline for pull request", newMasterTree.Sha, master.Object.Sha);
// create new commit for main branch
var newMainTree = await client.CreateTree(repository, new Dictionary<string, string> { { "README.md", "Hello World!" } });
var newMain = await client.CreateCommit(repository, "baseline for pull request", newMainTree.Sha, main.Object.Sha);
// update master
await client.Git.Reference.Update(repository.Owner.Login, repository.Name, "heads/master", new ReferenceUpdate(newMaster.Sha));
// update main
await client.Git.Reference.Update(repository.Owner.Login, repository.Name, "heads/main", new ReferenceUpdate(newMain.Sha));
// create new commit for feature branch
var featureBranchTree = await client.CreateTree(repository, new Dictionary<string, string> { { "README.md", "I am overwriting this blob with something new\nand a second line too" } });
var featureBranchCommit = await client.CreateCommit(repository, "this is the commit to merge into the pull request", featureBranchTree.Sha, newMaster.Sha);
var featureBranchCommit = await client.CreateCommit(repository, "this is the commit to merge into the pull request", featureBranchTree.Sha, newMain.Sha);
// create branch
return await client.Git.Reference.Create(repository.Owner.Login, repository.Name, new NewReference("refs/heads/my-branch", featureBranchCommit.Sha));
@@ -63,7 +63,7 @@ namespace Octokit.Tests.Integration.Helpers
public static async Task<PullRequest> CreatePullRequest(this IGitHubClient client, Repository repository, string branch = "my-branch")
{
var pullRequest = new NewPullRequest("Nice title for the pull request", branch, "master");
var pullRequest = new NewPullRequest("Nice title for the pull request", branch, "main");
var createdPullRequest = await client.PullRequest.Create(repository.Owner.Login, repository.Name, pullRequest);
return createdPullRequest;

View File

@@ -0,0 +1,13 @@
using System;
namespace Octokit.Tests.Integration
{
/// <summary>
/// A potentially flaky test could be:
/// * Calls for details of repositories which already exist and was not created by the test itself (so could disappear over time)
/// * Calls for details of users which already exist (so could disappear over time)
/// </summary>
public class PotentiallyFlakyTestAttribute : Attribute
{
}
}

View File

@@ -29,7 +29,7 @@ namespace Octokit.Tests.Integration.Reactive
using (var repoContext = await _github.CreateRepositoryContext(new NewRepository(Helper.MakeNameWithTimestamp("public-repo")) { AutoInit = true }))
{
// Create a new feature branch
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryId, "master");
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryId, "main");
var featureBranch = await Helper.CreateFeatureBranch(repoContext.RepositoryOwner, repoContext.RepositoryName, headCommit.Sha, "my-feature");
// Create a check run for the feature branch
@@ -51,7 +51,7 @@ namespace Octokit.Tests.Integration.Reactive
using (var repoContext = await _github.CreateRepositoryContext(new NewRepository(Helper.MakeNameWithTimestamp("public-repo")) { AutoInit = true }))
{
// Create a new feature branch
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryId, "master");
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryId, "main");
var featureBranch = await Helper.CreateFeatureBranch(repoContext.RepositoryOwner, repoContext.RepositoryName, headCommit.Sha, "my-feature");
// Create a check run for the feature branch
@@ -87,7 +87,7 @@ namespace Octokit.Tests.Integration.Reactive
using (var repoContext = await _github.CreateRepositoryContext(new NewRepository(Helper.MakeNameWithTimestamp("public-repo")) { AutoInit = true }))
{
// Create a new feature branch
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryId, "master");
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryId, "main");
var featureBranch = await Helper.CreateFeatureBranch(repoContext.RepositoryOwner, repoContext.RepositoryName, headCommit.Sha, "my-feature");
// Create a check run for the feature branch
@@ -119,7 +119,7 @@ namespace Octokit.Tests.Integration.Reactive
using (var repoContext = await _github.CreateRepositoryContext(new NewRepository(Helper.MakeNameWithTimestamp("public-repo")) { AutoInit = true }))
{
// Create a new feature branch
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryId, "master");
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryId, "main");
var featureBranch = await Helper.CreateFeatureBranch(repoContext.RepositoryOwner, repoContext.RepositoryName, headCommit.Sha, "my-feature");
// Create a check run for the feature branch
@@ -165,7 +165,7 @@ namespace Octokit.Tests.Integration.Reactive
using (var repoContext = await _github.CreateRepositoryContext(new NewRepository(Helper.MakeNameWithTimestamp("public-repo")) { AutoInit = true }))
{
// Create a new feature branch
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryId, "master");
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryId, "main");
var featureBranch = await Helper.CreateFeatureBranch(repoContext.RepositoryOwner, repoContext.RepositoryName, headCommit.Sha, "my-feature");
// Create a check run for the feature branch
@@ -200,7 +200,7 @@ namespace Octokit.Tests.Integration.Reactive
using (var repoContext = await _github.CreateRepositoryContext(new NewRepository(Helper.MakeNameWithTimestamp("public-repo")) { AutoInit = true }))
{
// Create a new feature branch
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryId, "master");
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryId, "main");
var featureBranch = await Helper.CreateFeatureBranch(repoContext.RepositoryOwner, repoContext.RepositoryName, headCommit.Sha, "my-feature");
// Create a check run for the feature branch
@@ -249,7 +249,7 @@ namespace Octokit.Tests.Integration.Reactive
using (var repoContext = await _github.CreateRepositoryContext(new NewRepository(Helper.MakeNameWithTimestamp("public-repo")) { AutoInit = true }))
{
// Create a new feature branch
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryId, "master");
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryId, "main");
var featureBranch = await Helper.CreateFeatureBranch(repoContext.RepositoryOwner, repoContext.RepositoryName, headCommit.Sha, "my-feature");
// Create a check run for the feature branch
@@ -284,7 +284,7 @@ namespace Octokit.Tests.Integration.Reactive
using (var repoContext = await _github.CreateRepositoryContext(new NewRepository(Helper.MakeNameWithTimestamp("public-repo")) { AutoInit = true }))
{
// Create a new feature branch
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryId, "master");
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryId, "main");
var featureBranch = await Helper.CreateFeatureBranch(repoContext.RepositoryOwner, repoContext.RepositoryName, headCommit.Sha, "my-feature");
// Create a check run for the feature branch
@@ -401,7 +401,7 @@ namespace Octokit.Tests.Integration.Reactive
using (var repoContext = await _github.CreateRepositoryContext(new NewRepository(Helper.MakeNameWithTimestamp("public-repo")) { AutoInit = true }))
{
// Create a new feature branch
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryId, "master");
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryId, "main");
var featureBranch = await Helper.CreateFeatureBranch(repoContext.RepositoryOwner, repoContext.RepositoryName, headCommit.Sha, "my-feature");
// Create a check run for the feature branch
@@ -434,7 +434,7 @@ namespace Octokit.Tests.Integration.Reactive
using (var repoContext = await _github.CreateRepositoryContext(new NewRepository(Helper.MakeNameWithTimestamp("public-repo")) { AutoInit = true }))
{
// Create a new feature branch
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryId, "master");
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryId, "main");
var featureBranch = await Helper.CreateFeatureBranch(repoContext.RepositoryOwner, repoContext.RepositoryName, headCommit.Sha, "my-feature");
// Create a check run for the feature branch

View File

@@ -28,7 +28,7 @@ namespace Octokit.Tests.Integration.Reactive
using (var repoContext = await _github.CreateRepositoryContext(new NewRepository(Helper.MakeNameWithTimestamp("public-repo")) { AutoInit = true }))
{
// Need to get a CheckSuiteId so we can test the Get method
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryOwner, repoContext.RepositoryName, "master");
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryOwner, repoContext.RepositoryName, "main");
var checkSuite = (await _githubAppInstallation.Check.Suite.GetAllForReference(repoContext.RepositoryOwner, repoContext.RepositoryName, headCommit.Sha)).CheckSuites.First();
// Get Check Suite by Id
@@ -46,7 +46,7 @@ namespace Octokit.Tests.Integration.Reactive
using (var repoContext = await _github.CreateRepositoryContext(new NewRepository(Helper.MakeNameWithTimestamp("public-repo")) { AutoInit = true }))
{
// Need to get a CheckSuiteId so we can test the Get method
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryId, "master");
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryId, "main");
var checkSuite = (await _githubAppInstallation.Check.Suite.GetAllForReference(repoContext.RepositoryId, headCommit.Sha)).CheckSuites.First();
// Get Check Suite by Id
@@ -77,7 +77,7 @@ namespace Octokit.Tests.Integration.Reactive
{
using (var repoContext = await _github.CreateRepositoryContext(new NewRepository(Helper.MakeNameWithTimestamp("public-repo")) { AutoInit = true }))
{
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryOwner, repoContext.RepositoryName, "master");
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryOwner, repoContext.RepositoryName, "main");
var checkSuites = await _githubAppInstallation.Check.Suite.GetAllForReference(repoContext.RepositoryOwner, repoContext.RepositoryName, headCommit.Sha);
@@ -94,7 +94,7 @@ namespace Octokit.Tests.Integration.Reactive
{
using (var repoContext = await _github.CreateRepositoryContext(new NewRepository(Helper.MakeNameWithTimestamp("public-repo")) { AutoInit = true }))
{
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryId, "master");
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryId, "main");
var checkSuites = await _githubAppInstallation.Check.Suite.GetAllForReference(repoContext.RepositoryId, headCommit.Sha);
@@ -178,7 +178,7 @@ namespace Octokit.Tests.Integration.Reactive
await _githubAppInstallation.Check.Suite.UpdatePreferences(repoContext.RepositoryOwner, repoContext.RepositoryName, preference);
// Create a new feature branch
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryOwner, repoContext.RepositoryName, "master");
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryOwner, repoContext.RepositoryName, "main");
var featureBranch = await Helper.CreateFeatureBranch(repoContext.RepositoryOwner, repoContext.RepositoryName, headCommit.Sha, "my-feature");
// Create a check suite for the feature branch
@@ -201,7 +201,7 @@ namespace Octokit.Tests.Integration.Reactive
await _githubAppInstallation.Check.Suite.UpdatePreferences(repoContext.RepositoryId, preference);
// Create a new feature branch
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryId, "master");
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryId, "main");
var featureBranch = await Helper.CreateFeatureBranch(repoContext.RepositoryOwner, repoContext.RepositoryName, headCommit.Sha, "my-feature");
// Create a check suite for the feature branch
@@ -234,7 +234,7 @@ namespace Octokit.Tests.Integration.Reactive
using (var repoContext = await _github.CreateRepositoryContext(new NewRepository(Helper.MakeNameWithTimestamp("public-repo")) { AutoInit = true }))
{
// Need to get a CheckSuiteId so we can test the Get method
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryId, "master");
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryId, "main");
var checkSuite = (await _githubAppInstallation.Check.Suite.GetAllForReference(repoContext.RepositoryId, headCommit.Sha)).CheckSuites.First();
var result = await _githubAppInstallation.Check.Suite.Rerequest(repoContext.RepositoryOwner, repoContext.RepositoryName, checkSuite.Id);
@@ -249,7 +249,7 @@ namespace Octokit.Tests.Integration.Reactive
using (var repoContext = await _github.CreateRepositoryContext(new NewRepository(Helper.MakeNameWithTimestamp("public-repo")) { AutoInit = true }))
{
// Need to get a CheckSuiteId so we can test the Get method
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryId, "master");
var headCommit = await _github.Repository.Commit.Get(repoContext.RepositoryId, "main");
var checkSuite = (await _githubAppInstallation.Check.Suite.GetAllForReference(repoContext.RepositoryId, headCommit.Sha)).CheckSuites.First();
var result = await _githubAppInstallation.Check.Suite.Rerequest(repoContext.RepositoryId, checkSuite.Id);