Transfer methods from SshClient to UserKeysClient

Add unit and integration tests and CreatePublicKeyContext() helper method
This commit is contained in:
Ryan Gribble
2016-02-16 23:08:41 +10:00
parent 84539f7baf
commit 047a78361a
18 changed files with 404 additions and 45 deletions
@@ -43,5 +43,16 @@ namespace Octokit.Tests.Integration.Helpers
return new EnterpriseUserContext(user);
}
internal async static Task<PublicKeyContext> CreatePublicKeyContext(this IGitHubClient client)
{
// Create a key
string keyTitle = "title";
string keyData = "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAjo4DqFKg8dOxiz/yjypmN1A4itU5QOStyYrfOFuTinesU/2zm9hqxJ5BctIhgtSHJ5foxkhsiBji0qrUg73Q25BThgNg8YFE8njr4EwjmqSqW13akx/zLV0GFFU0SdJ2F6rBldhi93lMnl0ex9swBqa3eLTY8C+HQGBI6MQUMw+BKp0oFkz87Kv+Pfp6lt/Uo32ejSxML1PT5hTH5n+fyl0ied+sRmPGZWmWoHB5Bc9mox7lB6I6A/ZgjtBqbEEn4HQ2/6vp4ojKfSgA4Mm7XMu0bZzX0itKjH1QWD9Lr5apV1cmZsj49Xf8SHucTtH+bq98hb8OOXEGFzplwsX2MQ==";
var key = await client.User.Keys.Create(new NewPublicKey(keyTitle, keyData));
return new PublicKeyContext(key);
}
}
}