예제 #1
0
        public void ShouldIncludeEncryptedSensitiveVariables()
        {
            var result = new VariablesFactory(fileSystem).Create(options);

            Assert.AreEqual("firstSensitiveVariableValue", result.Get("firstSensitiveVariableName"));
            Assert.AreEqual("secondSensitiveVariableValue", result.Get("secondSensitiveVariableName"));
            Assert.AreEqual("firstInsensitiveVariableValue", result.Get("firstInsensitiveVariableName"));
        }
예제 #2
0
        public void ShouldIncludeCleartextSensitiveVariables()
        {
            options.InputVariables.SensitiveVariablesPassword = null;

            var sensitiveVariables = new Dictionary <string, string> {
                { "firstSensitiveVariableName", "firstSensitiveVariableValue" }
            };

            File.WriteAllText(firstSensitiveVariablesFileName, JsonConvert.SerializeObject(sensitiveVariables));
            File.WriteAllText(secondSensitiveVariablesFileName, "{}");

            var result = new VariablesFactory(fileSystem).Create(options);

            Assert.AreEqual("firstSensitiveVariableValue", result.Get("firstSensitiveVariableName"));
            Assert.AreEqual("firstInsensitiveVariableValue", result.Get("firstInsensitiveVariableName"));
        }
예제 #3
0
        public void VariablesInAdditionalVariablesPathAreContributed()
        {
            try
            {
                using (var varFile = new TemporaryFile(Path.GetTempFileName()))
                {
                    new CalamariVariables
                    {
                        {
                            "new.key", "new.value"
                        }
                    }.Save(varFile.FilePath);

                    Environment.SetEnvironmentVariable(VariablesFactory.AdditionalVariablesPathVariable, varFile.FilePath);

                    var variables = new VariablesFactory(CalamariPhysicalFileSystem.GetPhysicalFileSystem())
                                    .Create(new CommonOptions("test"));

                    variables.Get("new.key").Should().Be("new.value");
                }
            }
            finally
            {
                Environment.SetEnvironmentVariable(VariablesFactory.AdditionalVariablesPathVariable, null);
            }
        }