Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix passing wrong reference in GetArchive method of RepositoryContentsClient #1113

Merged
merged 1 commit into from
Feb 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Octokit.Tests/Clients/RepositoryContentsClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,5 +219,22 @@ public async Task EnsuresNonNullArguments()
await Assert.ThrowsAsync<ArgumentNullException>(() => client.UpdateFile("org", "repo", "path/to/file", null));
}
}

public class TheGetArchiveMethod
{
[Fact]
public void EnsurePassingCorrectParameters()
{
var connection = Substitute.For<IApiConnection>();
var client = new RepositoryContentsClient(connection);

client.GetArchive("org", "repo", ArchiveFormat.Tarball, "dev");

const string expectedUri = "repos/org/repo/tarball/dev";
var expectedTimeSpan = TimeSpan.FromMinutes(60);

connection.Connection.Received().Get<byte[]>(Arg.Is<Uri>(uri => uri.ToString() == expectedUri), Arg.Is<TimeSpan>(span => span == expectedTimeSpan));
}
}
}
}
2 changes: 1 addition & 1 deletion Octokit/Clients/RepositoryContentsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public Task<string> GetArchiveLink(string owner, string name, ArchiveFormat arch
/// <returns>The binary contents of the archive</returns>
public Task<byte[]> GetArchive(string owner, string name, ArchiveFormat archiveFormat, string reference)
{
return GetArchive(owner, name, archiveFormat, string.Empty, TimeSpan.FromMinutes(60));
return GetArchive(owner, name, archiveFormat, reference, TimeSpan.FromMinutes(60));
}

/// <summary>
Expand Down