Skip to content
Merged
Changes from 1 commit
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
25 changes: 25 additions & 0 deletions src/Tests/Tests/XPack/Security/ApiKey/SecurityApiKeyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class SecurityApiKeyTests : CoordinatedIntegrationTestBase<XPackCluster>
private const string CreateApiKeyWithRolesStep = nameof(CreateApiKeyWithRolesStep);
private const string CreateApiKeyWithNoRolesStep = nameof(CreateApiKeyWithNoRolesStep);
private const string GetApiKeyStep = nameof(GetApiKeyStep);
private const string GetAllApiKeysStep = nameof(GetAllApiKeysStep);
private const string InvalidateApiKeyStep = nameof(InvalidateApiKeyStep);

public SecurityApiKeyTests(XPackCluster cluster, EndpointUsage usage) : base(new CoordinatedUsage(cluster, usage)
Expand Down Expand Up @@ -120,6 +121,25 @@ public SecurityApiKeyTests(XPackCluster cluster, EndpointUsage usage) : base(new
(v, c, r) => c.Security.CreateApiKeyAsync(r)
)
},
{
GetAllApiKeysStep, u =>
u.Calls<GetApiKeyDescriptor, GetApiKeyRequest, IGetApiKeyRequest, GetApiKeyResponse>(
v => new GetApiKeyRequest
{
RequestConfiguration = new RequestConfiguration
{
BasicAuthenticationCredentials = new BasicAuthenticationCredentials($"user-{v}", "password")
}
},
(v, d) => d
.RequestConfiguration(r => r.BasicAuthentication($"user-{v}", "password"))
,
(v, c, f) => c.Security.GetApiKey(f),
(v, c, f) => c.Security.GetApiKeyAsync(f),
(v, c, r) => c.Security.GetApiKey(r),
(v, c, r) => c.Security.GetApiKeyAsync(r)
)
},
{
GetApiKeyStep, u =>
u.Calls<GetApiKeyDescriptor, GetApiKeyRequest, IGetApiKeyRequest, GetApiKeyResponse>(
Expand Down Expand Up @@ -173,6 +193,11 @@ [I] public async Task SecurityCreateApiKeyResponse() => await Assert<CreateApiKe
r.ApiKey.Should().NotBeNullOrEmpty();
});

[I] public async Task SecurityGetAllApiKeysResponse() => await Assert<GetApiKeyResponse>(GetAllApiKeysStep, r =>
{
r.IsValid.Should().BeTrue();
});

[I] public async Task SecurityGetApiKeyResponse() => await Assert<GetApiKeyResponse>(GetApiKeyStep, r =>
{
r.IsValid.Should().BeTrue();
Expand Down