Пример #1
0
    def test_filter_frontend(self):
        """Test that the frontend filter works as expected."""
        filter_func = filters.filter_frontend('loadbalancer')

        results = []
        for frontend_name in ('loadbalancer', 'other', 'loadbalancer', ):
            self.frontend_name = frontend_name
            raw_line = self._build_test_string()
            log_line = Line(raw_line)
            results.append(filter_func(log_line))

        self.assertEqual(results, [True, False, True, ])
    def test_filter_frontend(self):
        """Test that the frontend filter works as expected."""
        filter_func = filters.filter_frontend('loadbalancer')

        results = []
        for frontend_name in ('loadbalancer', 'other', 'loadbalancer', ):
            self.frontend_name = frontend_name
            raw_line = self._build_test_string()
            log_line = HaproxyLogLine(raw_line)
            results.append(filter_func(log_line))

        self.assertEqual(results, [True, False, True, ])
def test_filter_frontend(http_line_factory, to_filter, to_check, result):
    """Test that the frontend filter works as expected."""
    current_filter = filters.filter_frontend(to_filter)
    line = http_line_factory(http_frontend_name=to_check)
    assert current_filter(line) is result