def test_filter_path(self):
        """Check that filter_path filter works as expected."""
        filter_func = filters.filter_path('/image')
        method = 'GET'
        protocol = 'HTTP/1.1'

        paths = ('/path/to/image', '/something/else', '/another/image/here', )
        results = []
        for path in paths:
            self.http_request = '{0} {1} {2}'.format(method, path, protocol)
            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_path(self):
        """Check that filter_path filter works as expected."""
        filter_func = filters.filter_path('/image')
        method = 'GET'
        protocol = 'HTTP/1.1'

        paths = ('/path/to/image', '/something/else', '/another/image/here', )
        results = []
        for path in paths:
            self.http_request = '{0} {1} {2}'.format(method, path, protocol)
            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_path(http_line_factory, path, result):
    """Check that filter_path filter works as expected."""
    current_filter = filters.filter_path('/image')
    http_request = f'GET {path} HTTP/1.1'
    line = http_line_factory(http_request=http_request)
    assert current_filter(line) is result