import unittest
import requests # quote requests and unittest package
class test_a(unittest.TestCase): # Create test class , The name of the test class must use test start , After the creation, you can go to pycharm There will be a play tag on the left side of the ,
def test_b(self): # Create a test function , The name also needs to be used test To name
url ="www.baidu.com"
data ={"a":1}
headers = {"token":"123aa"}
a=requests.post(url=url,data=data,headers=headers)
print(a.json())
def test_c(self): # Create a test function , The name also needs to be used test To name
url = "www.baidu.com?a=1"
data = {"a":1}
headers = {"token":"123aa"}
a=requests.grt(url=url,headers=headers)
print(a.json())
In the next article, we will talk about unittest How to assert