Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'qa/spec/support/api_spec.rb')
-rw-r--r--qa/spec/support/api_spec.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/qa/spec/support/api_spec.rb b/qa/spec/support/api_spec.rb
new file mode 100644
index 00000000000..5bf09da9020
--- /dev/null
+++ b/qa/spec/support/api_spec.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+module QA
+ RSpec.describe QA::Support::API do
+ describe ".masked_parsed_response" do
+ let(:response) { Struct.new(:body).new('{ "secret": "foobar", "name": "gitlab" }') }
+
+ it 'calls Masker to mask secrets' do
+ expect(QA::Support::Helpers::Masker).to receive(:mask)
+ .with(
+ JSON.parse(response.body, symbolize_names: true),
+ by_key: [:secret]
+ )
+
+ described_class.masked_parsed_response(response, mask_by_key: [:secret])
+ end
+
+ it 'accepts a single secret key' do
+ expect(QA::Support::Helpers::Masker).to receive(:mask)
+ .with(
+ JSON.parse(response.body, symbolize_names: true),
+ by_key: ['secret']
+ )
+
+ described_class.masked_parsed_response(response, mask_by_key: 'secret')
+ end
+ end
+ end
+end