(self)
| 212 | curl_to_request_kwargs("curl") |
| 213 | |
| 214 | def test_ignore_unknown_options(self): |
| 215 | # case 1: ignore_unknown_options=True: |
| 216 | with warnings.catch_warnings(): # avoid warning when executing tests |
| 217 | warnings.simplefilter("ignore") |
| 218 | curl_command = "curl --bar --baz http://www.example.com" |
| 219 | expected_result = {"method": "GET", "url": "http://www.example.com"} |
| 220 | assert curl_to_request_kwargs(curl_command) == expected_result |
| 221 | |
| 222 | # case 2: ignore_unknown_options=False (raise exception): |
| 223 | with pytest.raises(ValueError, match=r"Unrecognized options:.*--bar.*--baz"): |
| 224 | curl_to_request_kwargs( |
| 225 | "curl --bar --baz http://www.example.com", ignore_unknown_options=False |
| 226 | ) |
| 227 | |
| 228 | def test_must_start_with_curl_error(self): |
| 229 | with pytest.raises(ValueError, match="A curl command must start"): |
nothing calls this directly
no test coverage detected