Skip to content

Commit

Permalink
Add integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hnrkndrssn committed May 18, 2015
1 parent d8cef69 commit 6cdb1cf
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Helpers;
using Octokit.Tests.Integration;
using Xunit;

Expand Down Expand Up @@ -199,6 +200,48 @@ public async Task CanBeMerged()
Assert.True(result.Merged);
}

[IntegrationTest]
public async Task CanBeMergedWithNoOptionalInput()
{
await CreateTheWorld();

var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var pullRequest = await _fixture.Create(Helper.UserName, _repository.Name, newPullRequest);

var merge = new MergePullRequest();
var result = await _fixture.Merge(Helper.UserName, _repository.Name, pullRequest.Number, merge);

Assert.True(result.Merged);
}
[IntegrationTest]
public async Task CanBeMergedWithShaSpecified()
{
await CreateTheWorld();

var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var pullRequest = await _fixture.Create(Helper.UserName, _repository.Name, newPullRequest);

var merge = new MergePullRequest { Message = "thing the thing", Sha = pullRequest.Head.Sha };
var result = await _fixture.Merge(Helper.UserName, _repository.Name, pullRequest.Number, merge);

Assert.True(result.Merged);
}

[IntegrationTest]
public async Task CannotBeMerged()
{
await CreateTheWorld();
var fakeSha = new string('f', 40);

var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
var pullRequest = await _fixture.Create(Helper.UserName, _repository.Name, newPullRequest);

var merge = new MergePullRequest { Sha = fakeSha };
var ex = await AssertEx.Throws<ApiException>(async () => await _fixture.Merge(Helper.UserName, _repository.Name, pullRequest.Number, merge));

Assert.True(ex.ApiError.Message.StartsWith("Head branch was modified"));
}

[IntegrationTest]
public async Task UpdatesMaster()
{
Expand Down

0 comments on commit 6cdb1cf

Please sign in to comment.