test_search_mem.py 1.8 KB
import unittest
from atdd.PcPost import PcPost


class SearchMem(PcPost):

    def setUp(self):
        self.do_login(self.host, self.mobile, self.psw, self.domain)

    # 全部列表
    def test_search_mem(self):
        url = '/contact/Apicp/User/DepartmentMember'
        data = {
        }
        result = self.PcPost(url, data)
        print('接口地址:' + self.host + '/' + self.domain + url)
        # print(result)
        return result

    # 按姓名搜索
    def test_search_name(self):
        url = '/contact/Apicp/User/DepartmentMember'
        data = {
            'name': '刘洋'
        }
        result = self.PcPost(url, data)
        type(result)
        print('接口地址: ' + self.host + '/' + self.domain + url)
        self.assertEqual(0, result['errcode'], msg=result['errcode'])
        # self.assertEqual('ok', result['errsdkcode'], msg=result['errsdkcode'])  # 怎样断言返回结果中的limit(动态)数据?
        return result

    # 按手机号搜索
    def test_search_mobile(self):
        url = '/contact/Apicp/User/DepartmentMember'
        data = {
            'mobile': 13818801804
        }
        result = self.PcPost(url, data)
        print('接口地址:' + self.host + '/' + self.domain + url)
        self.assertEqual(0, result['errcode'], msg=result['errcode'])
        return result

    # 按角色搜索
    def test_search_role(self):
        url = '/contact/Apicp/User/DepartmentMember'
        data = {
            'role_ids[0]': '755DE1EC0A69039F18591A299B47E6F3'  # 需动态获取角色列表数据作为参数读取
        }
        result = self.PcPost(url, data)
        self.assertEqual(0, result['errcode'], msg=result['errcode'])
        print(result)  # 返回结果待验证?
        return result


if __name__ == '__main__':
    unittest.main()