Sha256: 2b2ec8916379c60a6b1f0b4e1e60f0de07a2e488a32d8f2b16365f28d8a73c9b

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 KB

Contents

require File::expand_path('../../spec_helper', __FILE__)
require 'opbeat/processors/sanitizedata'

describe Opbeat::Processor::SanitizeData do
  before do
    @client = double("client")
    @processor = Opbeat::Processor::SanitizeData.new(@client)
  end

  it 'should filter http data' do
    data = {
      'http' => {
        'data' => {
          'foo' => 'bar',
          'password' => 'hello',
          'the_secret' => 'hello',
          'a_password_here' => 'hello',
          'mypasswd' => 'hello',
        }
      }
    }

    result = @processor.process(data)

    vars = result["http"]["data"]
    expect(vars["foo"]).to eq("bar")
    expect(vars["password"]).to eq(Opbeat::Processor::SanitizeData::MASK)
    expect(vars["the_secret"]).to eq(Opbeat::Processor::SanitizeData::MASK)
    expect(vars["a_password_here"]).to eq(Opbeat::Processor::SanitizeData::MASK)
    expect(vars["mypasswd"]).to eq(Opbeat::Processor::SanitizeData::MASK)
  end

  it 'should filter credit card values' do
    data = {
      'ccnumba' => '4242424242424242'
    }

    result = @processor.process(data)
    expect(result["ccnumba"]).to eq(Opbeat::Processor::SanitizeData::MASK)
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
opbeat-1.1.1 spec/opbeat/sanitizedata_processor_spec.rb
opbeat-1.1.0 spec/opbeat/sanitizedata_processor_spec.rb
opbeat-1.0.0 spec/opbeat/sanitizedata_processor_spec.rb
opbeat-0.9.2 spec/opbeat/sanitizedata_processor_spec.rb