请求方式:POST
请求url:https://api.apiopen.top/developerLogin
请求参数:
名称 类型 必须 描述 示例
name string 是 账号 peakchao
passwd string 是 密码 123456
import unittest,requests
class Login(unittest.TestCase):
def login(self,names,passwds):
url="https://api.apiopen.top/developerLogin"
data={"name":names,"passwd":passwds}
a = requests.post(url, data=data)
return self.assertEqual(a.json()["code"],200)
def test_1_normal(self):
#data={"name":"peakchao","passwd":"123456"}
# a=requests.post("https://api.apiopen.top/developerLogin",data=data)
# self.assertEqual(a.json()["code"],200)
# self.assertEqual(a.json()["message"],'成功!')
self.login("peakchao","123456")
def test_2_allwrong(self):
data={"name":"zhangsan","passwd":"8888"}
# a2=requests.post("https://api.apiopen.top/developerLogin",params=data)
# self.assertEqual(a2.json()["code"], 200)
# self.assertEqual(a2.json()["message"], '成功!')
self.login("zhangsan","8888")
def test_3_onewrong(self):
data={"name":"peakchao","passwd":"98898"}
# a3=requests.post("https://api.apiopen.top/developerLogin",data=data)
# self.assertEqual(a3.json()["code"], 200)
# self.assertEqual(a3.json()["message"], '成功!')
self.login("peakchao","98898")
if __name__=='__main__':
unittest.main()