Sha256: 6a3394253e7c33f29c2bbd452cc2f797f4d226fa3749e51a45ee7b92f35a43d2

Contents?: true

Size: 1.46 KB

Versions: 49

Compression:

Stored size: 1.46 KB

Contents

require 'pact_broker/webhooks/redact_logs'

module PactBroker
  module Webhooks
    describe RedactLogs do
      describe ".call" do
        let(:string) do
          "Authorization: foo\nX-Thing: bar"
        end

        let(:x_auth_string) do
          "X-Authorization: bar foo\nX-Thing: bar"
        end

        let(:x_auth_token) do
          "X-Auth-Token: bar foo\nX-Thing: bar"
        end

        let(:x_authorization_token) do
          "X-Authorization-Token: bar foo\nX-Thing: bar"
        end

        let(:string_lower) do
          "authorization: foo\nX-Thing: bar"
        end

        it "hides the value of the Authorization header" do
          expect(RedactLogs.call(string)).to eq "Authorization: [REDACTED]\nX-Thing: bar"
        end

        it "hides the value of the X-Authorization header" do
          expect(RedactLogs.call(x_auth_string)).to eq "X-Authorization: [REDACTED]\nX-Thing: bar"
        end

        it "hides the value of the X-Auth-Token header" do
          expect(RedactLogs.call(x_auth_token)).to eq "X-Auth-Token: [REDACTED]\nX-Thing: bar"
        end

        it "hides the value of the X-Authorization-Token header" do
          expect(RedactLogs.call(x_authorization_token)).to eq "X-Authorization-Token: [REDACTED]\nX-Thing: bar"
        end

        it "hides the value of the authorization header" do
          expect(RedactLogs.call(string_lower)).to eq "authorization: [REDACTED]\nX-Thing: bar"
        end
      end
    end
  end
end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
pact_broker-2.34.0 spec/lib/pact_broker/webhooks/redact_logs_spec.rb
pact_broker-2.33.0 spec/lib/pact_broker/webhooks/redact_logs_spec.rb
pact_broker-2.32.0 spec/lib/pact_broker/webhooks/redact_logs_spec.rb
pact_broker-2.31.0 spec/lib/pact_broker/webhooks/redact_logs_spec.rb
pact_broker-2.30.0 spec/lib/pact_broker/webhooks/redact_logs_spec.rb
pact_broker-2.29.0 spec/lib/pact_broker/webhooks/redact_logs_spec.rb
pact_broker-2.27.6 spec/lib/pact_broker/webhooks/redact_logs_spec.rb
pact_broker-2.27.5 spec/lib/pact_broker/webhooks/redact_logs_spec.rb
pact_broker-2.27.4 spec/lib/pact_broker/webhooks/redact_logs_spec.rb
pact_broker-2.27.3 spec/lib/pact_broker/webhooks/redact_logs_spec.rb
pact_broker-2.27.2 spec/lib/pact_broker/webhooks/redact_logs_spec.rb
pact_broker-2.27.0 spec/lib/pact_broker/webhooks/redact_logs_spec.rb
pact_broker-2.26.1 spec/lib/pact_broker/webhooks/redact_logs_spec.rb
pact_broker-2.26.0 spec/lib/pact_broker/webhooks/redact_logs_spec.rb
pact_broker-2.25.0 spec/lib/pact_broker/webhooks/redact_logs_spec.rb
pact_broker-2.24.0 spec/lib/pact_broker/webhooks/redact_logs_spec.rb
pact_broker-2.23.4 spec/lib/pact_broker/webhooks/redact_logs_spec.rb
pact_broker-2.23.3 spec/lib/pact_broker/webhooks/redact_logs_spec.rb
pact_broker-2.23.2 spec/lib/pact_broker/webhooks/redact_logs_spec.rb
pact_broker-2.23.1 spec/lib/pact_broker/webhooks/redact_logs_spec.rb