|
| 1 | +"""Tests for missing-timeout.""" |
| 2 | + |
| 3 | +# pylint: disable=consider-using-with,import-error,no-member,no-name-in-module,reimported |
| 4 | + |
| 5 | +import requests |
| 6 | +from requests import ( |
| 7 | + delete, |
| 8 | + delete as delete_r, |
| 9 | + get, |
| 10 | + get as get_r, |
| 11 | + head, |
| 12 | + head as head_r, |
| 13 | + options, |
| 14 | + options as options_r, |
| 15 | + patch, |
| 16 | + patch as patch_r, |
| 17 | + post, |
| 18 | + post as post_r, |
| 19 | + put, |
| 20 | + put as put_r, |
| 21 | + request, |
| 22 | + request as request_r, |
| 23 | +) |
| 24 | + |
| 25 | +# requests without timeout |
| 26 | +requests.delete("http://localhost") # [missing-timeout] |
| 27 | +requests.get("http://localhost") # [missing-timeout] |
| 28 | +requests.head("http://localhost") # [missing-timeout] |
| 29 | +requests.options("http://localhost") # [missing-timeout] |
| 30 | +requests.patch("http://localhost") # [missing-timeout] |
| 31 | +requests.post("http://localhost") # [missing-timeout] |
| 32 | +requests.put("http://localhost") # [missing-timeout] |
| 33 | +requests.request("call", "http://localhost") # [missing-timeout] |
| 34 | + |
| 35 | +delete_r("http://localhost") # [missing-timeout] |
| 36 | +get_r("http://localhost") # [missing-timeout] |
| 37 | +head_r("http://localhost") # [missing-timeout] |
| 38 | +options_r("http://localhost") # [missing-timeout] |
| 39 | +patch_r("http://localhost") # [missing-timeout] |
| 40 | +post_r("http://localhost") # [missing-timeout] |
| 41 | +put_r("http://localhost") # [missing-timeout] |
| 42 | +request_r("call", "http://localhost") # [missing-timeout] |
| 43 | + |
| 44 | +delete("http://localhost") # [missing-timeout] |
| 45 | +get("http://localhost") # [missing-timeout] |
| 46 | +head("http://localhost") # [missing-timeout] |
| 47 | +options("http://localhost") # [missing-timeout] |
| 48 | +patch("http://localhost") # [missing-timeout] |
| 49 | +post("http://localhost") # [missing-timeout] |
| 50 | +put("http://localhost") # [missing-timeout] |
| 51 | +request("call", "http://localhost") # [missing-timeout] |
| 52 | + |
| 53 | +kwargs_wo_timeout = {} |
| 54 | +post("http://localhost", **kwargs_wo_timeout) # [missing-timeout] |
| 55 | + |
| 56 | +# requests valid cases |
| 57 | +requests.delete("http://localhost", timeout=10) |
| 58 | +requests.get("http://localhost", timeout=10) |
| 59 | +requests.head("http://localhost", timeout=10) |
| 60 | +requests.options("http://localhost", timeout=10) |
| 61 | +requests.patch("http://localhost", timeout=10) |
| 62 | +requests.post("http://localhost", timeout=10) |
| 63 | +requests.put("http://localhost", timeout=10) |
| 64 | +requests.request("call", "http://localhost", timeout=10) |
| 65 | + |
| 66 | +delete_r("http://localhost", timeout=10) |
| 67 | +get_r("http://localhost", timeout=10) |
| 68 | +head_r("http://localhost", timeout=10) |
| 69 | +options_r("http://localhost", timeout=10) |
| 70 | +patch_r("http://localhost", timeout=10) |
| 71 | +post_r("http://localhost", timeout=10) |
| 72 | +put_r("http://localhost", timeout=10) |
| 73 | +request_r("call", "http://localhost", timeout=10) |
| 74 | + |
| 75 | +delete("http://localhost", timeout=10) |
| 76 | +get("http://localhost", timeout=10) |
| 77 | +head("http://localhost", timeout=10) |
| 78 | +options("http://localhost", timeout=10) |
| 79 | +patch("http://localhost", timeout=10) |
| 80 | +post("http://localhost", timeout=10) |
| 81 | +put("http://localhost", timeout=10) |
| 82 | +request("call", "http://localhost", timeout=10) |
| 83 | + |
| 84 | +kwargs_timeout = {'timeout': 10} |
| 85 | +post("http://localhost", **kwargs_timeout) |
0 commit comments