test/secrets_test.rb in instana-1.199.0 vs test/secrets_test.rb in instana-1.199.1

- old
+ new

@@ -76,20 +76,30 @@ url = 'example.com?instantiate=true' assert_redacted @subject.remove_from_query(url, sample_config), %w(instantiate) end + def test_without_url + sample_config = { + "matcher"=>"contains", + "list"=>["stan"] + } + + url = 'filter[instantiate]=true' + assert_redacted @subject.remove_from_query(url, sample_config), %w(filter[instantiate]), raw_str: true + end + private def url_for(keys) url = URI('http://example.com') url.query = URI.encode_www_form(keys.map { |k| [k, rand(1..100)]}) url.to_s end - def assert_redacted(str, keys) - url = URI(str) - params = CGI.parse(url.query) + def assert_redacted(str, keys, raw_str: false) + params = raw_str ? CGI.parse(str) : CGI.parse(URI(str).query) + pp params assert_equal keys, params.select { |_, v| v == %w(<redacted>) }.keys, 'to be redacted' end end