def test_querystring_as_string(self):
        data = {"request": {"query_string": "foo=bar&password=hello&access_token=hello"}}

        proc = InvenioSanitizeProcessor(Mock())
        result = proc.process(data)

        self.assertTrue("request" in result)
        http = result["request"]
        self.assertEquals(http["query_string"], "foo=bar&password=hello&access_token=%(m)s" % dict(m=proc.MASK))
    def test_http(self):
        data = {"request": {"data": VARS, "env": VARS, "headers": VARS, "cookies": VARS}}

        proc = InvenioSanitizeProcessor(Mock())
        result = proc.process(data)

        self.assertTrue("request" in result)
        http = result["request"]
        for n in ("data", "env", "headers", "cookies"):
            self.assertTrue(n in http)
            self._check_vars_sanitized(http[n], proc)
    def test_querystring_as_string(self):
        data = {
            'request': {
                'query_string': 'foo=bar&password=hello&access_token=hello',
            }
        }

        proc = InvenioSanitizeProcessor(Mock())
        result = proc.process(data)

        self.assertTrue('request' in result)
        http = result['request']
        self.assertEquals(
            http['query_string'],
            'foo=bar&password=hello&access_token=%(m)s' % dict(m=proc.MASK))
    def test_querystring_as_string(self):
        data = {
            'request': {
                'query_string': 'foo=bar&password=hello&access_token=hello',
            }
        }

        proc = InvenioSanitizeProcessor(Mock())
        result = proc.process(data)

        self.assertTrue('request' in result)
        http = result['request']
        self.assertEquals(
            http['query_string'],
            'foo=bar&password=hello&access_token=%(m)s' % dict(m=proc.MASK)
        )
    def test_http(self):
        data = {
            'request': {
                'data': VARS,
                'env': VARS,
                'headers': VARS,
                'cookies': VARS,
            }
        }

        proc = InvenioSanitizeProcessor(Mock())
        result = proc.process(data)

        self.assertTrue('request' in result)
        http = result['request']
        for n in ('data', 'env', 'headers', 'cookies'):
            self.assertTrue(n in http)
            self._check_vars_sanitized(http[n], proc)
    def test_http(self):
        data = {
            'request': {
                'data': VARS,
                'env': VARS,
                'headers': VARS,
                'cookies': VARS,
            }
        }

        proc = InvenioSanitizeProcessor(Mock())
        result = proc.process(data)

        self.assertTrue('request' in result)
        http = result['request']
        for n in ('data', 'env', 'headers', 'cookies'):
            self.assertTrue(n in http)
            self._check_vars_sanitized(http[n], proc)