test_logout.py
993 Bytes
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
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import unittest
import urllib3
from commons.api.login import login
from commons.api.logout import logout
from commons import common as com
from commons.MySession import my
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
li=login()
lo=logout()
class test_logout(unittest.TestCase):
"新增登记接口"
@classmethod
def setUpClass(cls):
#通过登录接口获取session
cls.se=li.login_session("hz_wenze", "111111")
@unittest.case_mark(my.mark())
def test_logout_01(self):
"成功登出账户"
re=lo.post(self.se, "user03")
print(re.json())
#响应断言
self.assertEqual(re.status_code, 200)
self.assertTrue("'code':'200'" in str(re.json()).replace(" ",""))
@classmethod
def tearDownClass(cls):
cls.se.close()
if __name__ == "__main__":
unittest.main(verbosity=2)
# com.run_one(test_logout("test_01_logout"))