def test_contains_no_match(self):
        matcher = 'contains'
        kwlist = ['XXXXXX']

        query_params = "one=1&Two=two&THREE=&4='+'&five='okyeah'"

        stripped = strip_secrets_from_query(query_params, matcher, kwlist)

        self.assertEqual(stripped, "one=1&Two=two&THREE=&4='+'&five='okyeah'")
    def test_regex_no_match(self):
        matcher = 'regex'
        kwlist = [r"\d\d\d"]

        query_params = "one=1&Two=two&THREE=&4='+'&five='okyeah'"

        stripped = strip_secrets_from_query(query_params, matcher, kwlist)

        self.assertEqual(stripped, "one=1&Two=two&THREE=&4='+'&five='okyeah'")
    def test_bad_kwlist(self):
        matcher = 'equals'
        kwlist = None

        query_params = "one=1&Two=two&THREE=&4='+'&five='okyeah'"

        stripped = strip_secrets_from_query(query_params, matcher, kwlist)

        self.assertEqual(stripped, "one=1&Two=two&THREE=&4='+'&five='okyeah'")
    def test_equals_with_none(self):
        matcher = 'equals'
        kwlist = ['Two']

        query_params = None

        stripped = strip_secrets_from_query(query_params, matcher, kwlist)

        self.assertEqual('', stripped)
    def test_contains_ignore_case(self):
        matcher = 'contains-ignore-case'
        kwlist = ['FI']

        query_params = "one=1&Two=two&THREE=&4='+'&five='okyeah'"

        stripped = strip_secrets_from_query(query_params, matcher, kwlist)

        self.assertEqual(stripped,
                         "one=1&Two=two&THREE=&4='+'&five=<redacted>")
    def test_equals(self):
        matcher = 'equals'
        kwlist = ['Two']

        query_params = "one=1&Two=two&THREE=&4='+'&five='okyeah'"

        stripped = strip_secrets_from_query(query_params, matcher, kwlist)

        self.assertEqual(stripped,
                         "one=1&Two=<redacted>&THREE=&4='+'&five='okyeah'")
    def test_equals_with_full_url(self):
        matcher = 'equals'
        kwlist = ['Two']

        query_params = "http://www.x.org/signup?one=1&Two=two&THREE=&4='+'&five='okyeah'"

        stripped = strip_secrets_from_query(query_params, matcher, kwlist)

        self.assertEqual(
            stripped,
            "http://www.x.org/signup?one=1&Two=<redacted>&THREE=&4='+'&five='okyeah'"
        )