Merge pull request #1347 from WhitWaldo/additional-secrets-testing

Added unit test to Secrets API test suite
This commit is contained in:
Whit Waldo 2024-10-11 02:28:44 -05:00 committed by GitHub
commit 4d78706eb9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 27 additions and 1 deletions

View File

@ -1,4 +1,4 @@
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// Copyright 2021 The Dapr Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -93,6 +93,32 @@ namespace Dapr.Client.Test
secretsResponse["redis_secret"].Should().Be("Guess_Redis");
}
[Fact]
public async Task GetSecretAsync_WithSlashesInName()
{
await using var client = TestClient.CreateForDaprClient();
var request = await client.CaptureGrpcRequestAsync(async DaprClient =>
{
return await DaprClient.GetSecretAsync("testStore", "us-west-1/org/xpto/secretabc");
});
request.Dismiss();
//Get Request and validate
var envelope = await request.GetRequestEnvelopeAsync<Autogenerated.GetSecretRequest>();
envelope.StoreName.Should().Be("testStore");
envelope.Key.Should().Be("us-west-1/org/xpto/secretabc");
var secrets = new Dictionary<string, string> { { "us-west-1/org/xpto/secretabc", "abc123" } };
var secretsResponse = await SendResponseWithSecrets(secrets, request);
//Get response and validate
secretsResponse.Count.Should().Be(1);
secretsResponse.ContainsKey("us-west-1/org/xpto/secretabc").Should().BeTrue();
secretsResponse["us-west-1/org/xpto/secretabc"].Should().Be("abc123");
}
[Fact]
public async Task GetSecretAsync_ReturnMultipleSecrets()
{