Ejemplo n.º 1
0
    def test_filter_backend(self):
        """Test that the backend filter works as expected."""
        filter_func = filters.filter_backend('default')

        results = []
        for backend_name in ('default', 'anonymous', 'registered', ):
            self.backend_name = backend_name
            raw_line = self._build_test_string()
            log_line = Line(raw_line)
            results.append(filter_func(log_line))

        self.assertEqual(results, [True, False, False, ])
    def test_filter_backend(self):
        """Test that the backend filter works as expected."""
        filter_func = filters.filter_backend('default')

        results = []
        for backend_name in ('default', 'anonymous', 'registered', ):
            self.backend_name = backend_name
            raw_line = self._build_test_string()
            log_line = HaproxyLogLine(raw_line)
            results.append(filter_func(log_line))

        self.assertEqual(results, [True, False, False, ])
Ejemplo n.º 3
0
def test_filter_backend(http_line_factory, to_filter, to_check, result):
    """Test that the backend filter works as expected."""
    current_filter = filters.filter_backend(to_filter)
    line = http_line_factory(http_backend_name=to_check)
    assert current_filter(line) is result