import unittest
import requests
import json
class MyTestCase(unittest.TestCase):
def test01_login(self):
url="http://test.ceshi.com:8000/applet/user/login"
data={
"mobile":"11122223333",
"password":"111111"
}
header={"content-type":"application/x-www-form-urlencoded"}
res=requests.post(url,headers=header,data=data)
print(res.text)
code=res.status_code
self.assertEqual(code, 200)
def test02_userinfo(self):
url="http://test.ceshi.com:8000/applet/user/getUserInfo"
header={"token":"BearereyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiLmiYvmnLrnlKjmiLczMzMzIiwiY3JlYXRlZCI6MTU5ODU4MTA2MDc3MCwiZXhwIjoxNjAyODE0NjYwfQ.t36NNCtu9aep7GLlvNHjs8"}
res=requests.post(url,headers=header)
print(res.json())
code=res.status_code
self.assertEqual(code, 200)
if __name__ == '__main__':
unittest.main()