File tree Expand file tree Collapse file tree 1 file changed +10
-15
lines changed
Expand file tree Collapse file tree 1 file changed +10
-15
lines changed Original file line number Diff line number Diff line change 11import requests
2- import uuid
2+ import random
33
4- unique_number = str (uuid .uuid4 ()) # e.g. 5b4832b4-da4c-48b2-8512-68fb49b69de1
54
6-
7- def create_json_object ():
5+ def create_new_post_object ():
86
97 return {
10- "users" : [
11- {
12- "user" : {
13- "id" : unique_number ,
14- "name" : "John Smith" ,
15- "phone_1" : "0612345678" ,
16- "phone_2" : "0992345678" ,
17- }
18- }
19- ]
8+ "name" : "John Smith" ,
9+ "address" : {
10+ "street" : "Main Street" ,
11+ "number" : random .randint (1000 , 9999 ),
12+ "zipCode" : 90210 ,
13+ "city" : "Beverly Hills"
14+ }
2015 }
2116
2217
2318def test_send_json_with_unique_number_check_status_code ():
24- response = requests .post ("http ://httpbin.org /post" , json = create_json_object ())
19+ response = requests .post ("https ://postman-echo.com /post" , json = create_new_post_object ())
2520 print (response .request .body )
2621 assert response .status_code == 200
You can’t perform that action at this time.
0 commit comments