|
1 | 1 | ##########################GO-LICENSE-START################################ |
2 | | -# Copyright 2014 ThoughtWorks, Inc. |
| 2 | +# Copyright 2016 ThoughtWorks, Inc. |
3 | 3 | # |
4 | 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | # you may not use this file except in compliance with the License. |
|
134 | 134 | end |
135 | 135 | end |
136 | 136 |
|
| 137 | + it 'should mask the value of secure environment variable for a stage' do |
| 138 | + stage = StageConfigMother.stage_config("stage1") |
| 139 | + environment_variable_config_new = EnvironmentVariableConfig.new("env2", "value2") |
| 140 | + environment_variable_config_new.setIsSecure(true) |
| 141 | + stage.setVariables(EnvironmentVariablesConfig.new([EnvironmentVariableConfig.new("env1", "value1"), environment_variable_config_new])) |
| 142 | + template = PipelineTemplateConfigMother.create_template("t1", [stage].to_java(StageConfig)) |
| 143 | + assign(:template_config, template) |
| 144 | + render |
| 145 | + Capybara.string(response.body).find("#definition_view_stage_1").tap do |stage| |
| 146 | + stage.find(".tab-content #environment_variables_stage_1.tab-pane.active table.variables").tap do |table| |
| 147 | + table.find("thead").tap do |head| |
| 148 | + head.find("tr").tap do |row| |
| 149 | + expect(row).to have_selector("th", :text => "Name") |
| 150 | + expect(row).to have_selector("th", :text => "Value") |
| 151 | + end |
| 152 | + end |
| 153 | + table.find("tbody").tap do |body| |
| 154 | + body.all("tr").tap do |rows| |
| 155 | + expect(rows[0]).to have_selector("td.name_value_cell", :text => "env1") |
| 156 | + expect(rows[0]).to have_selector("td.name_value_cell", :text => "value1") |
| 157 | + expect(rows[1]).to have_selector("td.name_value_cell", :text => "env2") |
| 158 | + expect(rows[1]).to have_selector("td.name_value_cell", :text => "****") |
| 159 | + end |
| 160 | + end |
| 161 | + end |
| 162 | + end |
| 163 | + end |
| 164 | + |
137 | 165 | it "should not show environment variables table if none are configured" do |
138 | 166 | template = PipelineTemplateConfigMother.create_template("t1") |
139 | 167 | assign(:template_config, template) |
|
0 commit comments