Exemple #1
0
        public void Return_BasePath_WithCorrectSuffix()
        {
            // Assign
            var link = @"test/";
            var obj  = new HashiCorpVaultConfigurationProvider(Mock.Of <IHashiCorpVaultClient>(), link, new[] { "key" });

            // Act
            var result = obj.GetBasePath(link);

            // Assert
            Assert.Equal(link, result);
        }
Exemple #2
0
        public void LoadsAllSecretsFromVault()
        {
            // Assign
            var path    = "secret";
            var value   = "some_secret";
            var secrets = new[] { "group1/key" };

            var client = new Mock <IHashiCorpVaultClient>(MockBehavior.Strict);

            client.Setup(c => c.GetSecretAsync(It.IsAny <string>())).Returns(Task.FromResult(value));

            // Act
            var provider = new HashiCorpVaultConfigurationProvider(client.Object, path, secrets);

            provider.Load();

            // Assert
            client.VerifyAll();
            Assert.Equal("some_secret", provider.Get("group1:key"));
        }