tidy up tests

This commit is contained in:
Brendan Forster
2019-09-22 17:18:18 -03:00
parent 92e3ca79bd
commit 0c3fbeb51f

View File

@@ -87,22 +87,7 @@ public class EnterpriseManagementConsoleClientTests
}
}
private async Task DeleteManagementAuthorizedKeyIfExists(string keyData)
{
// Check if key already exists
var keys = await _github.Enterprise.ManagementConsole.GetAllAuthorizedKeys(
EnterpriseHelper.ManagementConsolePassword);
// Delete it if so
if (keys.Any(x => x.Key == keyData))
{
await _github.Enterprise.ManagementConsole.DeleteAuthorizedKey(
new AuthorizedKeyRequest(keyData),
EnterpriseHelper.ManagementConsolePassword).ConfigureAwait(false);
}
}
[GitHubEnterpriseTest]
[GitHubEnterpriseManagementConsoleTest]
public async Task CanGetAllAuthorizedKeys()
{
var keys = await _github.Enterprise.ManagementConsole.GetAllAuthorizedKeys(
@@ -115,7 +100,7 @@ public class EnterpriseManagementConsoleClientTests
Assert.True(keys.All(x => !string.IsNullOrEmpty(x.Comment)));
}
[GitHubEnterpriseTest]
[GitHubEnterpriseManagementConsoleTest]
public async Task CanAddAndDeleteAuthorizedKey()
{
var keyData = "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAjo4DqFKg8dOxiz/yjypmN1A4itU5QOStyYrfOFuTinesU/2zm9hqxJ5BctIhgtSHJ5foxkhsiBji0qrUg73Q25BThgNg8YFE8njr4EwjmqSqW13akx/zLV0GFFU0SdJ2F6rBldhi93lMnl0ex9swBqa3eLTY8C+HQGBI6MQUMw+BKp0oFkz87Kv+Pfp6lt/Uo32ejSxML1PT5hTH5n+fyl0ied+sRmPGZWmWoHB5Bc9mox7lB6I6A/ZgjtBqbEEn4HQ2/6vp4ojKfSgA4Mm7XMu0bZzX0itKjH1QWD9Lr5apV1cmZsj49Xf8SHucTtH+bq98hb8OOXEGFzplwsX2MQ== my-test-key";