def test_filter_server(self):
        """Test that the server filter works as expected."""
        filter_func = filters.filter_server('instance8')

        results = []
        for server_name in ('instance7', 'instance', 'instance8', ):
            self.server_name = server_name
            raw_line = self._build_test_string()
            log_line = Line(raw_line)
            results.append(filter_func(log_line))

        self.assertEqual(results, [False, False, True, ])
    def test_filter_server(self):
        """Test that the server filter works as expected."""
        filter_func = filters.filter_server('instance8')

        results = []
        for server_name in ('instance7', 'instance', 'instance8', ):
            self.server_name = server_name
            raw_line = self._build_test_string()
            log_line = HaproxyLogLine(raw_line)
            results.append(filter_func(log_line))

        self.assertEqual(results, [False, False, True, ])
def test_filter_server(http_line_factory, to_filter, to_check, result):
    """Test that the server filter works as expected."""
    current_filter = filters.filter_server(to_filter)
    line = http_line_factory(http_server_name=to_check)
    assert current_filter(line) is result