()
| 13 | return ret |
| 14 | |
| 15 | def test_parser_cli(): |
| 16 | assert get_parse_cli("\"http://example.com\"") == ["http://example.com"] |
| 17 | assert get_parse_cli("\"smb://example.com\"") == ["smb://example.com"] |
| 18 | assert get_parse_cli("\"https://www.example.co.us\"") == ["https://www.example.co.us"] |
| 19 | |
| 20 | assert get_parse_cli("\"/path/to/file\"") == ["/path/to/file"] |
| 21 | assert get_parse_cli("\"../path/to/file\"") == ["../path/to/file"] |
| 22 | assert get_parse_cli("\"./path/to/file\"") == ["./path/to/file"] |
| 23 | assert get_parse_cli("\"/user/create.action?user=Test\"") == ["/user/create.action?user=Test"] |
| 24 | assert get_parse_cli("\"/api/create.php?user=test&pass=test#home\"") == ["/api/create.php?user=test&pass=test#home"] |
| 25 | assert get_parse_cli("\"/wrong/file/test<>b\"") == [] |
| 26 | |
| 27 | assert get_parse_cli("\"api/create.php\"") == ["api/create.php"] |
| 28 | assert get_parse_cli("\"api/create.php?user=test\"") == ["api/create.php?user=test"] |
| 29 | assert get_parse_cli("\"api/create.php?user=test&pass=test\"") == ["api/create.php?user=test&pass=test"] |
| 30 | assert get_parse_cli("\"api/create.php?user=test#home\"") == ["api/create.php?user=test#home"] |
| 31 | assert get_parse_cli("\"user/create.action?user=Test\"") == ["user/create.action?user=Test"] |
| 32 | assert get_parse_cli("\"user/create.notaext?user=Test\"") == [] |
| 33 | |
| 34 | assert get_parse_cli("\"/path/to/file\"") == ["/path/to/file"] |
| 35 | assert get_parse_cli("\"../path/to/file\"") == ["../path/to/file"] |
| 36 | assert get_parse_cli("\"./path/to/file\"") == ["./path/to/file"] |
| 37 | assert get_parse_cli("\"/wrong/file/test<>b\"") == [] |
| 38 | |
| 39 | # REST API (no extension) |
| 40 | assert get_parse_cli("\"api/user\"") == ["api/user"] |
| 41 | assert get_parse_cli("\"v1/create\"") == ["v1/create"] |
| 42 | assert get_parse_cli("\"api/v1/user/2\"") == ["api/v1/user/2"] |
| 43 | assert get_parse_cli("\"api/v1/search?text=Test Hello\"") == ["api/v1/search?text=Test Hello"] |
| 44 | |
| 45 | assert get_parse_cli("\"test_1.json\"") == ["test_1.json"] |
| 46 | assert get_parse_cli("\"test2.aspx?arg1=tmp1+tmp2&arg2=tmp3\"") == ["test2.aspx?arg1=tmp1+tmp2&arg2=tmp3"] |
| 47 | assert get_parse_cli("\"addUser.action\"") == ["addUser.action"] |
| 48 | assert get_parse_cli("\"main.js\"") == ["main.js"] |
| 49 | assert get_parse_cli("\"index.html\"") == ["index.html"] |
| 50 | assert get_parse_cli("\"robots.txt\"") == ["robots.txt"] |
| 51 | assert get_parse_cli("\"users.xml\"") == ["users.xml"] |
| 52 | assert get_parse_cli("\"UserModel.name\"") == [] |
| 53 | |
| 54 | assert get_parse_cli("\"app/admin/admin.controller.js\"") == ["app/admin/admin.controller.js"] |
| 55 | assert get_parse_cli("\"services/customer.services.js\"") == ["services/customer.services.js"] |
| 56 | |
| 57 | def test_parser_cli_multi(): |
| 58 | assert set(get_parse_cli("href=\"http://example.com\";href=\"/api/create.php\"")) == set(["http://example.com", "/api/create.php"]) |
nothing calls this directly
no test coverage detected