Exemplo n.º 1
0
def test_filter_by_path(http_request):
    f = context.gen_filter_by_path(context.cmp_contains, 'p**n') # find the fun websites
    fn = context.gen_filter_by_path(context.cmp_contains, 'p**n', negate=True) # find the boring websites
    
    http_request.status_line = 'GET / HTTP/1.1'
    assert not f(http_request)
    assert fn(http_request)

    http_request.status_line = 'GET /path/to/great/p**n HTTP/1.1'
    assert f(http_request)
    assert not fn(http_request)

    http_request.status_line = 'GET /path/to/p**n/great HTTP/1.1'
    assert f(http_request)
    assert not fn(http_request)
Exemplo n.º 2
0
def test_filter_by_path(http_request):
    f = context.gen_filter_by_path(['ct', 'p**n']) # find the fun websites
    fn = context.gen_filter_by_path(['nct', 'p**n']) # find the boring websites
    
    http_request.start_line = 'GET / HTTP/1.1'
    assert not f(http_request)
    assert fn(http_request)

    http_request.start_line = 'GET /path/to/great/p**n HTTP/1.1'
    assert f(http_request)
    assert not fn(http_request)

    http_request.start_line = 'GET /path/to/p**n/great HTTP/1.1'
    assert f(http_request)
    assert not fn(http_request)
Exemplo n.º 3
0
def test_filter_by_path(http_request):
    f = context.gen_filter_by_path(['ct', 'p**n'])  # find the fun websites
    fn = context.gen_filter_by_path(['nct',
                                     'p**n'])  # find the boring websites

    http_request.start_line = 'GET / HTTP/1.1'
    assert not f(http_request)
    assert fn(http_request)

    http_request.start_line = 'GET /path/to/great/p**n HTTP/1.1'
    assert f(http_request)
    assert not fn(http_request)

    http_request.start_line = 'GET /path/to/p**n/great HTTP/1.1'
    assert f(http_request)
    assert not fn(http_request)
Exemplo n.º 4
0
def test_filter_by_path(http_request):
    f = context.gen_filter_by_path(context.cmp_contains,
                                   'p**n')  # find the fun websites
    fn = context.gen_filter_by_path(context.cmp_contains, 'p**n',
                                    negate=True)  # find the boring websites

    http_request.status_line = 'GET / HTTP/1.1'
    assert not f(http_request)
    assert fn(http_request)

    http_request.status_line = 'GET /path/to/great/p**n HTTP/1.1'
    assert f(http_request)
    assert not fn(http_request)

    http_request.status_line = 'GET /path/to/p**n/great HTTP/1.1'
    assert f(http_request)
    assert not fn(http_request)