Skip to content

Commit

Permalink
add integration tests for Update repository
Browse files Browse the repository at this point in the history
  • Loading branch information
ryangribble committed Oct 1, 2016
1 parent e31ac86 commit d1b0ff4
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions Octokit.Tests.Integration/Clients/RepositoriesClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,58 @@ public async Task UpdatesHasWikiWithRepositoryId()
Assert.Equal(false, _repository.HasWiki);
}

[IntegrationTest]
public async Task UpdatesMergeMethod()
{
var github = Helper.GetAuthenticatedClient();

using (var context = await github.CreateRepositoryContext("public-repo"))
{
var updateRepository = new RepositoryUpdate(context.RepositoryName)
{
AllowMergeCommit = false,
AllowSquashMerge = false,
AllowRebaseMerge = true
};

var editedRepository = await github.Repository.Edit(context.RepositoryOwner, context.RepositoryName, updateRepository);
Assert.False(editedRepository.AllowMergeCommit);
Assert.False(editedRepository.AllowSquashMerge);
Assert.True(editedRepository.AllowRebaseMerge);

var repository = await github.Repository.Get(context.RepositoryOwner, context.RepositoryName);
Assert.False(repository.AllowMergeCommit);
Assert.False(repository.AllowSquashMerge);
Assert.True(repository.AllowRebaseMerge);
}
}

[IntegrationTest]
public async Task UpdatesMergeMethodWithRepositoryId()
{
var github = Helper.GetAuthenticatedClient();

using (var context = await github.CreateRepositoryContext("public-repo"))
{
var updateRepository = new RepositoryUpdate(context.RepositoryName)
{
AllowMergeCommit = true,
AllowSquashMerge = true,
AllowRebaseMerge = false
};

var editedRepository = await github.Repository.Edit(context.RepositoryId, updateRepository);
Assert.True(editedRepository.AllowMergeCommit);
Assert.True(editedRepository.AllowSquashMerge);
Assert.False(editedRepository.AllowRebaseMerge);

var repository = await github.Repository.Get(context.RepositoryId);
Assert.True(repository.AllowMergeCommit);
Assert.True(repository.AllowSquashMerge);
Assert.False(repository.AllowRebaseMerge);
}
}

public void Dispose()
{
Helper.DeleteRepo(Helper.GetAuthenticatedClient().Connection, _repository);
Expand Down

0 comments on commit d1b0ff4

Please sign in to comment.