def teststeps(self): STEP(1, '先列出学生') r = sstudent.student_list() listret = r.json() studentlist = listret["retlist"] STEP(2, '添加一个学生') r = sstudent.add_student('cyj', '程咬金', 6, GSTORE['g_classid'], 13400000000) addret = r.json() self.addstudentid = addret['id'] STEP(3, '验证参数返回值') CHECK_POINT('返回的retcode值=0', addret['retcode'] == 0) STEP(4, '修改新增的学员信息') r = sstudent.modify_student('addret["id"]', '程咬金', 13411111111) r = sstudent.student_list() listrest = r.json() CHECK_POINT('返回的retcode值=0', addret['retcode'] == 0) expected = { "retlist": studentlist + [{ "classid": GSTORE['g_classid'], "realname": "程咬金", "username": "******", "phonenumber": "13411111111", "id": addret['id'] }], "retcode": 0 } CHECK_POINT('返回的消息体数据正确', expected == listrest)
def teststeps(self): STEP(1, '先列出学生') r = sstudent.student_list() listret = r.json() studentlist = listret["retlist"] STEP(2, '修改一个不存在的学生') r = sstudent.modify_student('0', '尉迟恭', '13451810000') addret = r.json() STEP(3, '验证参数返回值') CHECK_POINT('返回的retcode值=404', addret['retcode'] == 404) STEP(4, '检查系统数据') r = sstudent.student_list() listrest = r.json() expected = {"retlist": studentlist, "retcode": 0} CHECK_POINT('返回的消息体数据正确', expected == listrest)
def teststeps(self): STEP(1, '先列出学生') r = sstudent.student_list() listret = r.json() studentlist = listret["retlist"] STEP(2, '删除不存在的学生') r = sstudent.del_student(0) addret = r.json() STEP(4, '验证参数返回值') CHECK_POINT('返回的retcode值=404', addret['retcode'] == 404) STEP(5, '检查系统数据') r = sstudent.student_list() listrest = r.json() expected = {"retlist": studentlist, "retcode": 0} CHECK_POINT('返回的消息体数据正确', expected == listrest)
def teststeps(self): STEP(1, '先列出学生') r = sstudent.student_list() listret = r.json() studentlist = listret["retlist"] STEP(2, '添加一个学生') r = sstudent.add_student('yuchigong', '尉迟恭', 6, GSTORE['g_classid'], 13451810000) addret = r.json() STEP(3, '验证参数返回值') CHECK_POINT('返回的retcode值=1', addret['retcode'] == 1) STEP(4, '检查系统数据') r = sstudent.student_list() listrest = r.json() expected = {"retlist": studentlist, "retcode": 0} CHECK_POINT('返回的消息体数据正确', expected == listrest)
def teststeps(self): STEP(1, '先列出学生') r = sstudent.student_list() listret = r.json() studentlist = listret["retlist"] STEP(2, '添加一个学生') r = sstudent.add_student('cyj', '程咬金', 6, GSTORE['g_classid'], 13451810000) addret = r.json() STEP(3, '删除新增的学生') r = sstudent.del_student(addret['id']) STEP(4, '验证参数返回值') CHECK_POINT('返回的retcode值=0', addret['retcode'] == 0) STEP(5, '检查系统数据') r = sstudent.student_list() listrest = r.json() expected = {"retlist": studentlist, "retcode": 0} CHECK_POINT('返回的消息体数据正确', expected == listrest)
def teststeps(self): STEP(1, '新增一个学生 ') r = sstudent.add_student('yuchigong', '尉迟恭', 6, GSTORE['g_classid'], 13451810000) addret = r.json() self.addstudentret = addret['id'] STEP(3, '验证参数返回值') CHECK_POINT('返回的retcode值=0', addret['retcode'] == 0) STEP(4, '检查系统数据') r = sstudent.student_list() listrest = r.json() expected = { "retlist": [{ "classid": GSTORE['g_classid'], "realname": "尉迟恭", "username": "******", "phonenumber": "13451810000", "id": addret['id'] }], "retcode": 0 } CHECK_POINT('返回的消息体数据正确', expected == listrest)