public void SecretShouldBeRelevantDependingOnFolderLevel(string secret, string configPath, string secretValue) { // ARRANGE var yamlSecretsProvider = new YamlSecretsProvider(ConfigFixturePath, new YamlConfigReader(new IoWrapper())); // ACT string?confValue = yamlSecretsProvider.GetSecretFromPath(secret, configPath); // ASSERT Assert.Equal(secretValue, confValue); }
public void SecretLoadAllSecretsInDictionaryShouldBeCorrect() { // ARRANGE & ACT var yamlConfig = new YamlSecretsProvider(ConfigFixturePath, new YamlConfigReader(new IoWrapper())); var secrets = yamlConfig.GetAllSecrets(); // ASSERT Assert.Equal(3, secrets.Count); Assert.True(secrets.ContainsKey(ConfigFixturePath)); Assert.True(secrets.ContainsKey(Path.Combine(ConfigFixturePath, "level2"))); Assert.True(secrets.ContainsKey(Path.Combine(ConfigFixturePath, "level2", "level3"))); Assert.Equal("test", secrets[ConfigFixturePath]["secret_only_exists_here"]); Assert.Equal("20", secrets[Path.Combine(ConfigFixturePath, "level2")]["secret_int"]); Assert.Equal("40", secrets[Path.Combine(ConfigFixturePath, "level2", "level3")]["secret_int"]); }
public void NormalLoadSecretsShouldGetCorrectValues() { // ARRANGE AND ACT var yamlConfig = new YamlSecretsProvider(ConfigFixturePath, new YamlConfigReader(new IoWrapper())); IDictionary <string, string> secrets = yamlConfig.GetSecretsFromFile(GetFixturePath("secrets_normal.yaml")); // ASSERT Assert.True(secrets.ContainsKey("secret_int")); Assert.Equal("10", secrets["secret_int"]); Assert.True(secrets.ContainsKey("secret_string")); Assert.Equal("hello", secrets["secret_string"]); Assert.True(secrets.ContainsKey("secret_string_noquotes")); Assert.Equal("hello no quotes", secrets["secret_string_noquotes"]); }