def test_sysRoleGetResourceModify(self):
        '''正确'''

        url = "http://192.168.2.26:8080/sys/sysrescource"

        payload = {
            "id": 15,
            "available": 1,
            "name": "资源21",
            "parentId": 0,
            "permission": "1",
            "seq": "1",
            "systemCode": "01",
            "type": "1",
            "url": "http://www.baidu.com"
        }

        headers = {
            'Content-Type': "application/json",
            'access_token': GetUser_token.GetUser_token(),
            'Cache-Control': "no-cache"
        }

        response = requests.request("PUT",
                                    url,
                                    data=json.dumps(payload),
                                    headers=headers)

        print(response.json()['message'])
        self.assertEqual("ok", response.json()['message'], msg="ok")
    def test_paramNull_modifyUserInfo(self):
        url = "http://192.168.2.26:8080/sys/sysuser"
        headers = {
            'Content-Type': "application/json",
            'access_token': GetUser_token.GetUser_token(),
            'Cache-Control': "no-cache"
        }
        payload_IDnull = {"id": "","idno": self.id_number,"positionId": "1","systemCode": "03","userCode": "ZY00030",
            "userEmail": "*****@*****.**",
            "userMobile": "13818764292",
            "userName": "******",
            "userSex": 1
        }
        response = requests.request("PUT", url, data=json.dumps(payload_IDnull), headers=headers)
        self.assertEqual("id为空", response.json()['message'], msg="id为空")

        payload_PositionIdnull = {"id": "66", "idno": self.id_number, "positionId": "", "systemCode": "03",
                          "userCode": "ZY00030",
                          "userEmail": "*****@*****.**",
                          "userMobile": "13818764292",
                          "userName": "******",
                          "userSex": 1
                          }
        response = requests.request("PUT", url, data=json.dumps(payload_PositionIdnull), headers=headers)
        self.assertEqual("岗位为空", response.json()['message'], msg="岗位为空")
예제 #3
0
    def test_error_sysRoleGetResourceAdd(self):
        '''错误'''

        url = "http://192.168.2.26:8080/sys/sysrescource"

        payload = {
            "id": 15,
            "available": 1,
            "name": "资源21",
            "parentId": 1,
            "permission": "1",
            "seq": "1",
            "systemCode": "wri",
            "type": "1",
            "url": ""
        }

        headers = {
            'Content-Type': "application/json",
            'access_token': GetUser_token.GetUser_token(),
            'Cache-Control': "no-cache"
        }

        response = requests.request("POST",
                                    url,
                                    data=json.dumps(payload),
                                    headers=headers)

        print(response.json()['message'])
        self.assertEqual("类型为菜单时候,链接必填",
                         response.json()['message'],
                         msg="类型为菜单时候,链接必填")
예제 #4
0
 def test_error_modifyuserpwd(self):
     url = "http://192.168.2.26:8080/sys/user/modifypwd"
     headers = {
         'Content-Type': "application/json",
         'access_token': GetUser_token.GetUser_token(),
         'Cache-Control': "no-cache"
     }
     payload = {"oldPwd": " ", "newPwd": "111111"}
     response = requests.request("PUT", url, data=json.dumps(payload), headers=headers)
     print(response.json()['message'])
     self.assertEqual("旧密码为空", response.json()['message'], msg="旧密码为空")
예제 #5
0
    def test_signout(self):
        '''退出登录'''
        url = "http://192.168.2.26:8080/uaa/signout"
        headers = {
            'access_token': GetUser_token.GetUser_token(),
            'Cache-Control': "no-cache"
        }

        response = requests.request("POST", url, headers=headers)

        print(response.json()['message'])
        self.assertEqual("成功", response.json()['message'], msg="成功")
예제 #6
0
    def test_getuserinfo(self):
        url = "http://192.168.2.26:8080/sys/user"

        headers = {
            'access_token': GetUser_token.GetUser_token(),
            'Cache-Control': "no-cache"
        }

        response = requests.request("GET", url, headers=headers)

        print(response.json()['data'])
        self.assertEqual("admin", response.json()['data']['userAccount'], msg="admin")
    def test_error_sysUserCodeGet(self):
        url = "http://192.168.2.26:8080/sys/sysuser/01"

        headers = {
            'Content-Type': "application/json",
            'access_token': GetUser_token.GetUser_token(),
            'Cache-Control': "no-cache"
        }

        response = requests.request("GET", url, headers=headers)

        print(response.json()['message'])
        self.assertEqual("no data", response.json()['message'], msg="no data")
    def test_sysRoleGetCompanyAll(self):

        url = "http://192.168.2.26:8080/sys/company/all"

        headers = {
            'Content-Type': "application/json",
            'access_token': GetUser_token.GetUser_token(),
            'Cache-Control': "no-cache"
        }

        response = requests.request("GET", url, headers=headers)

        print(response.json()['code'])
        self.assertEqual("00", response.json()['code'], msg="00")
예제 #9
0
    def test_errorORnull_sysRoleget(self):
        randID = ''.join([random.choice(string.digits) for _ in range(5)])
        print(randID)
        url = "http://192.168.2.26:8080/sys/sysrole/" + randID + ""

        headers = {
            'Content-Type': "application/json",
            'access_token': GetUser_token.GetUser_token(),
            'Cache-Control': "no-cache"
        }

        response = requests.request("GET", url, headers=headers)

        print(response.json()['message'])
        self.assertEqual("no data", response.json()['message'], msg="no data")
    def test_sysRoleGetRootChildlist(self):
        randID = ''.join([random.choice(string.digits) for _ in range(1)])
        print(randID)
        url = "http://192.168.2.26:8080/sys/department/rootlist/" + randID + ""

        headers = {
            'Content-Type': "application/json",
            'access_token': GetUser_token.GetUser_token(),
            'Cache-Control': "no-cache"
        }

        response = requests.request("GET", url, headers=headers)

        print(response.json()['code'])
        self.assertEqual("00", response.json()['code'], msg="00")
    def test_sysRolegetResourceTree(self):
        randID = ''.join([random.choice(string.digits) for _ in range(1)])
        print(randID)
        url = "http://192.168.2.26:8080/sys/sysrescource/tree/" + randID + ""

        headers = {
            'Content-Type': "application/json",
            'access_token': GetUser_token.GetUser_token(),
            'Cache-Control': "no-cache"
        }

        response = requests.request("GET", url, headers=headers)

        print(response.json()['code'])
        self.assertEqual("xxx", response.json()['code'], msg="1")
    def test_sysRoleAuth(self):
        url = "http://192.168.2.26:8080/sys/sysrole/auth"

        payload = {"roleId": "11", "resourceIds": [1, 2]}

        headers = {
            'Content-Type': "application/json",
            'access_token': GetUser_token.GetUser_token(),
            'Cache-Control': "no-cache"
        }

        response = requests.request("POST",
                                    url,
                                    data=json.dumps(payload),
                                    headers=headers)
        print(response.text)
        self.assertEqual("ok", response.json()['message'], msg="ok")
    def test_DelRole(self):
        '''正确参数'''

        url = "http://192.168.2.26:8080/sys/sysrole/13"

        headers = {
            'Content-Type': "application/json",
            'access_token': GetUser_token.GetUser_token(),
            'Cache-Control': "no-cache"
        }

        response = requests.request("DELETE", url, headers=headers)

        print(response.json()['message'])
        self.assertEqual("请先置无效,再删除",
                         response.json()['message'],
                         msg="请先置无效,再删除")
예제 #14
0
    def test_error_setRole(self):
        '''错误'''

        url = "http://192.168.2.26:8080/sys/sysrole"

        payload = {"roleName": "我曹", "systemCode": "我擦"}

        headers = {
            'Content-Type': "application/json",
            'access_token': GetUser_token.GetUser_token(),
            'Cache-Control': "no-cache"
        }

        response = requests.request("POST",
                                    url,
                                    data=json.dumps(payload),
                                    headers=headers)

        print(response.json()['message'])
예제 #15
0
 def test_error_modifyUserInfo(self):
     url = "http://192.168.2.26:8080/sys/sysuser"
     headers = {
         'Content-Type': "application/json",
         'access_token': GetUser_token.GetUser_token(),
         'Cache-Control': "no-cache"
     }
     payload = {
         "idno": self.id_number,
         "positionId": "1",
         "systemCode": "03",
         "userCode": "ZY00030",
         "userEmail": "*****@*****.**",
         "userMobile": "18516279771",
         "userName": "******",
         "userSex": 1
     }
     response = requests.request("POST",
                                 url,
                                 data=json.dumps(payload),
                                 headers=headers)
     print(response.json()['message'])
     self.assertEqual("员工号已使用", response.json()['message'], msg="员工号已使用")