def setUpClass(cls): cls.zone = '.000Z' cls.ManagerId = "BJ_PIM_1" token = base_function.login(cls.ManagerId, base_function.dsm_username, base_function.dsm_passwd) cls.token1 = eval(token.content)['Token'] base_function.DeleteSubcription(cls.token1, ManagerId=cls.ManagerId) token = base_function.login(cls.ManagerId, base_function.dsm_username, base_function.dsm_passwd) cls.token = eval(token.content)['Token'] base_function.CreateSubcription(cls.token, ManagerId=cls.ManagerId)
def test_NFV_Daemon_login_05(self): # 登录,username类型为Int ManagerId = "BJ-PIM-1" username = 123456 res = base_function.login(ManagerId, username, base_function.dsm_passwd) self.assertEqual(400, res.status_code)
def test_NFV_Daemon_login_12(self): # 登录,password长度为17 ManagerId = "BJ-PIM-1" passwd = "01234567891234567" res = base_function.login(ManagerId, base_function.dsm_username, passwd) self.assertEqual(400, res.status_code)
def test_NFV_Daemon_login_08(self): # 登录,username长度为17 ManagerId = "BJ-PIM-1" username = "******" res = base_function.login(ManagerId, username, base_function.dsm_passwd) self.assertEqual(400, res.status_code)
def test_NFV_Daemon_login_14(self): # 登录,ManagerId包含特殊字符 ManagerId = "BJ-PIM-1~!@#$%^&*()_+}{:" res = base_function.login(ManagerId, base_function.dsm_username, base_function.dsm_passwd) print res.text self.assertEqual(201, res.status_code)
def test_NFV_Daemon_login_13(self): # 登录,password错误 ManagerId = "BJ-PIM-1" res = base_function.login(ManagerId, base_function.dsm_username, 'admin11') print res.text self.assertEqual(401, res.status_code)
def test_NFV_Daemon_login_01(self): #登录,ManagerId长度为36 ManagerId = '012345678901234567890123456789123456' res = base_function.login(ManagerId, base_function.dsm_username, base_function.dsm_passwd) print json.dumps(res.content) self.assertEqual(201, res.status_code)
def test_NFV_Daemon_login_09(self): # 登录,password类型为int ManagerId = "BJ-PIM-1" passwd = "0123456789123456" res = base_function.login(ManagerId, base_function.dsm_username, int(passwd)) print res.content self.assertEqual(400, res.status_code)
def test_NFV_Daemon_login_04(self): #登录,ManagerId类型为Int ManagerId = 123456 print base_function.dsm_username res = base_function.login(ManagerId, base_function.dsm_username, base_function.dsm_passwd) print res.content, res.status_code self.assertEqual(400, res.status_code)
def test_NFV_Daemon_CreateSubcription_20(self): # 订阅,IdentityUri重复订阅 base_function.CreateSubcription(self.token) manageid = 'BJ_PIM_2' token = base_function.login(manageid, "admin", "admin") token = eval(token.content)['Token'] print token res = base_function.CreateSubcription(token, ManagerId=manageid) base_function.DeleteSubcription(token, ManagerId=manageid) print res.content self.assertEqual(403, res.status_code)
def setUp(self): token = base_function.login(self.ManagerId, base_function.dsm_username, base_function.dsm_passwd) self.token = eval(token.content)['Token']
def setUpClass(cls): cls.ManagerId = "BJ_PIM_1" token = base_function.login(cls.ManagerId, base_function.dsm_username, base_function.dsm_passwd) token = eval(token.content)['Token'] base_function.DeleteSubcription(token, cls.ManagerId)
def test_NFV_Daemon_login_03(self): # 登录,ManagerId长度为0 ManagerId = '' res = base_function.login(ManagerId, base_function.dsm_username, base_function.dsm_passwd) self.assertEqual(400, res.status_code)