File: test_filter_codes.py

package info (click to toggle)
wfuzz 3.1.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,648 kB
  • sloc: python: 13,161; makefile: 59; sh: 4
file content (70 lines) | stat: -rw-r--r-- 2,134 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import pytest


@pytest.mark.parametrize(
    "fuzzres_from_url, filter_string, expected_result",
    [
        (
            "http://www.wfuzz.org/path/test.php?param=1&param2=2",
            "r.urlp.scheme='http'",
            True,
        ),
        (
            "http://www.wfuzz.org/path/test.php?param=1&param2=2",
            "r.urlp.netloc='www.wfuzz.org'",
            True,
        ),
        (
            "http://www.wfuzz.org/path/test.php?param=1&param2=2",
            "r.urlp.path='/path/test.php'",
            True,
        ),
        (
            "http://www.wfuzz.org/path/test.php?param=1&param2=2",
            "r.urlp.ffname='test.php'",
            True,
        ),
        (
            "http://www.wfuzz.org/path/test.php?param=1&param2=2",
            "r.urlp.fname='test'",
            True,
        ),
        (
            "http://www.wfuzz.org/path/test.php?param=1&param2=2",
            "r.urlp.hasquery",
            True,
        ),
        (
            "http://www.wfuzz.org/path/test.php?param=1&param2=2",
            "not r.urlp.isbllist",
            True,
        ),
    ],
    indirect=["fuzzres_from_url"],
)
def test_urlp(filter_obj, fuzzres_from_url, filter_string, expected_result):
    assert filter_obj.is_visible(fuzzres_from_url, filter_string) == expected_result


@pytest.mark.parametrize(
    "fuzzres_from_url, filter_string, expected_result",
    [("http://www.wfuzz.org/path?param=1&param2=2", "r.is_path", False)],
    indirect=["fuzzres_from_url"],
)
def test_ispath(filter_obj, fuzzres_from_url, filter_string, expected_result):
    assert filter_obj.is_visible(fuzzres_from_url, filter_string) == expected_result


@pytest.mark.parametrize(
    "fuzzres_from_url, filter_string, expected_result",
    [
        (
            "http://www.wfuzz.org/path?param=1&param2=2",
            "r.pstrip",
            "http://www.wfuzz.org/path-gparam-gparam2",
        ),
    ],
    indirect=["fuzzres_from_url"],
)
def test_pstrip(filter_obj, fuzzres_from_url, filter_string, expected_result):
    assert filter_obj.is_visible(fuzzres_from_url, filter_string) == expected_result