mirror of https://github.com/dapr/dotnet-sdk.git
Merge pull request #1347 from WhitWaldo/additional-secrets-testing
Added unit test to Secrets API test suite
This commit is contained in:
commit
4d78706eb9
|
|
@ -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()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue