语法:
# -*- coding:utf-8 -*-
from interface.interfaceSchoolManage import SchoolManage
import unittest
import requests,random
name = random.randint(100, 1000000)
class TestSchoolLogin(unittest.TestCase):
def setUp(self):
self.s = requests.session()
self.uri = "http://192.168.241.129:8081"
self.school = SchoolManage(self.s) # 实例化
def test_school_login_success(self):
r = self.school.school_login(self.uri, "admin", "660B8D2D5359FF6F94F8D3345698F88C")
self.assertIn("退出", r.text)
def test_school_login_pwd_error(self):
r = self.school.school_login(self.uri, "admin", "1660B8D2D5359FF6F94F8D3345698F88C")
self.assertNotIn("退出", r.text)
def tearDown(self):
self.s.close() # 关闭登录
if __name__ == '__main__':
unittest.main()