Beispiel #1
0
    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'")
Beispiel #2
0
    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'")
Beispiel #3
0
    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)
Beispiel #4
0
    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'")
Beispiel #5
0
    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>")
Beispiel #6
0
    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'")
Beispiel #7
0
    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'"
        )