Skip to content

Commit

Permalink
Merge pull request #1139 from M-Zuber/fix#1136-IUserKeysClient.GetAll…
Browse files Browse the repository at this point in the history
…-GetAllForCurrent

IUserKeysClient.GetAll -> GetAllForCurrent()
  • Loading branch information
ryangribble committed Mar 13, 2016
2 parents c09fb8f + e041f52 commit 00cdf99
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 14 deletions.
3 changes: 2 additions & 1 deletion Octokit.Reactive/Clients/IObservableUserKeysClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public interface IObservableUserKeysClient
/// https://developer.github.com/v3/users/keys/#list-your-public-keys
/// </remarks>
/// <returns></returns>
IObservable<PublicKey> GetAll();
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
IObservable<PublicKey> GetAllForCurrent();

/// <summary>
/// Gets all verified public keys for a user.
Expand Down
4 changes: 2 additions & 2 deletions Octokit.Reactive/Clients/ObservableUserKeysClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ public ObservableUserKeysClient(IGitHubClient client)
/// https://developer.github.com/v3/users/keys/#list-your-public-keys
/// </remarks>
/// <returns></returns>
public IObservable<PublicKey> GetAll()
public IObservable<PublicKey> GetAllForCurrent()
{
return _client.GetAll().ToObservable().SelectMany(k => k);
return _client.GetAllForCurrent().ToObservable().SelectMany(k => k);
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions Octokit.Tests.Integration/Clients/UserKeysClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public async Task CanGetAllForCurrentUser()

using (var context = await github.CreatePublicKeyContext())
{
var keys = await github.User.Keys.GetAll();
var keys = await github.User.Keys.GetAllForCurrent();
Assert.NotEmpty(keys);

var first = keys[0];
Expand Down Expand Up @@ -72,7 +72,7 @@ public async Task CanCreateAndDeleteKey()
await github.User.Keys.Delete(key.Id);

// Verify key no longer exists
var keys = await github.User.Keys.GetAll();
var keys = await github.User.Keys.GetAllForCurrent();
Assert.False(keys.Any(k => k.Title == keyTitle && k.Key == keyData));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public async Task CanGetAllForCurrentUser()
{
using (var context = await _github.CreatePublicKeyContext())
{
var observable = _github.User.Keys.GetAll();
var observable = _github.User.Keys.GetAllForCurrent();
var keys = await (observable.ToList());

Assert.NotEmpty(keys);
Expand Down Expand Up @@ -80,7 +80,7 @@ public async Task CanCreateAndDeleteKey()
await _github.User.Keys.Delete(key.Id);

// Verify key no longer exists
var keys = await (_github.User.Keys.GetAll().ToList());
var keys = await (_github.User.Keys.GetAllForCurrent().ToList());
Assert.False(keys.Any(k => k.Title == keyTitle && k.Key == keyData));
}
}
Expand Down
4 changes: 2 additions & 2 deletions Octokit.Tests/Clients/UserKeysClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Octokit.Tests.Clients
{
public class UserKeysClientTests
{
public class TheGetAllMethod
public class TheGetAllForCurrentMethod
{
[Fact]
public void RequestsTheCorrectUrl()
Expand All @@ -17,7 +17,7 @@ public void RequestsTheCorrectUrl()
var client = new UserKeysClient(connection);

var expectedUri = "user/keys";
client.GetAll();
client.GetAllForCurrent();

connection.Received().GetAll<PublicKey>(
Arg.Is<Uri>(u => u.ToString() == expectedUri));
Expand Down
6 changes: 3 additions & 3 deletions Octokit.Tests/Reactive/ObservableUserKeysClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ namespace Octokit.Tests.Reactive
{
public class ObservableUserKeysClientTests
{
public class TheGetAllMethod
public class TheGetAllForCurrentMethod
{
[Fact]
public void CallsIntoClient()
{
var gitHubClient = Substitute.For<IGitHubClient>();
var client = new ObservableUserKeysClient(gitHubClient);

client.GetAll();
client.GetAllForCurrent();

gitHubClient.User.Keys.Received().GetAll();
gitHubClient.User.Keys.Received().GetAllForCurrent();
}
}

Expand Down
3 changes: 2 additions & 1 deletion Octokit/Clients/IUserKeysClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public interface IUserKeysClient
/// https://developer.github.com/v3/users/keys/#list-your-public-keys
/// </remarks>
/// <returns></returns>
Task<IReadOnlyList<PublicKey>> GetAll();
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
Task<IReadOnlyList<PublicKey>> GetAllForCurrent();

/// <summary>
/// Gets all verified public keys for a user.
Expand Down
2 changes: 1 addition & 1 deletion Octokit/Clients/UserKeysClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public UserKeysClient(IApiConnection apiConnection)
/// https://developer.github.com/v3/users/keys/#list-your-public-keys
/// </remarks>
/// <returns></returns>
public Task<IReadOnlyList<PublicKey>> GetAll()
public Task<IReadOnlyList<PublicKey>> GetAllForCurrent()
{
return ApiConnection.GetAll<PublicKey>(ApiUrls.Keys());
}
Expand Down

0 comments on commit 00cdf99

Please sign in to comment.