-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_PostTimeout.py
47 lines (37 loc) · 1.11 KB
/
test_PostTimeout.py
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
# import requests
#
# url = "https://reqres.in/api/users"
# payload = {
# "name": "Ishita",
# "job": "Shah"
# }
#
# response = requests.post(url, data=payload, timeout=1, verify=False)
#
# print("Response Code:", response)
# print("Response Status Code:", response.status_code)
#
# response = requests.post(url, data=payload, timeout=0.1, verify=False)
#
# print("Response Code:", response)
# print("New Response Status Code:", response.status_code)
import pytest
from utilconfig.commonutil import CommonUtil
request_method = "POST"
endpoint = "api/users"
payload = {
"name": "RestAPI",
"job": "API Testing"
}
timeout_A = 1
timeout_B = 0.01
call_util = CommonUtil()
@pytest.fixture
def fix_demo():
print("\nthis is before fixture demo")
yield
print("\nthis is after fixture demo")
def test_validate_postrequest_timeout_A(fix_demo):
assert call_util.make_request_call(request_method, endpoint, ptimeout=timeout_A)
def test_validate_postrequest_timeout_B(fix_demo):
assert call_util.make_request_call(request_method, endpoint, ptimeout=timeout_B)