Example #1
0
 def test_system_query(self, query_url, METHOD, DATA, CODE, CONTENT,
                       expect):
     query_data = {
         'pageSize': DATA['pageSize'],
         'pageIndex': DATA['pageIndex'],
         'userName': DATA['userName'],
         'empName': DATA['empName']
     }
     resp = System('..\\conf\\base.conf').do_query(query_url, query_data)
     num = resp.json()
     if num['totalRow'] != 0:
         if DATA['userName'] == 'WNCD008':
             counts = uiti.query_one(
                 '..\\conf\\base.conf',
                 'SELECT COUNT(id) FROM system_user  WHERE name="WNCD008"')
             if counts[0] == num['totalRow']:
                 actual = 'query ok'
             else:
                 actual = 'query fail'
         elif DATA['userName'] == '':
             counts = uiti.query_one(
                 '..\\conf\\base.conf',
                 'SELECT COUNT(id) FROM system_user where passwd_status=1 and passwd2_status=1'
             )
             print(counts)
             if counts[0] == num['totalRow']:
                 actual = 'query ok'
             else:
                 actual = 'query fail'
     else:
         actual = 'query fail'
     self.assertEqual(actual, expect)
Example #2
0
    def test_dict_query(self, query_url, METHOD, DATA, CODE, CONTENT, expect):
        query_data = {
            'pageSize': DATA['pageSize'],
            'pageIndex': DATA['pageIndex'],
            'typename': DATA['typename']
        }
        resp = System('..\\conf\\base.conf').do_dic_query(
            query_url, query_data)
        num = resp.json()
        if num['totalRow'] != 0:
            if DATA['typename'] == '员工状态':
                counts = uiti.query_one(
                    '..\\conf\\base.conf',
                    'SELECT COUNT(dict_type_id) FROM dictionary_type  WHERE dict_typename="员工状态"'
                )
                if counts[0] == num['totalRow']:
                    actual = 'query ok'
                else:
                    actual = 'query fail'
            elif DATA['typename'] == '':
                counts = uiti.query_one(
                    '..\\conf\\base.conf',
                    'SELECT COUNT(dict_type_id) FROM dictionary_type ')

                if counts[0] == num['totalRow']:
                    actual = 'query ok'
                else:
                    actual = 'query fail'
        else:
            actual = 'query fail'
        self.assertEqual(actual, expect)
Example #3
0
    def test_role_query(self, query_url, METHOD, DATA, CODE, CONTENT, expect):
        query_data = {
            'pageSize': DATA['pageSize'],
            'pageIndex': DATA['pageIndex'],
            'roleName': DATA['roleName']
        }
        resp = System('..\\conf\\base.conf').do_role_query(
            query_url, query_data)
        num = resp.json()
        if num['totalRow'] != 0:
            if DATA['roleName'] == '系统管理员':
                counts = uiti.query_one(
                    '..\\conf\\base.conf',
                    'SELECT COUNT(id) FROM system_role  where name="系统管理员"')
                if counts[0] == num['totalRow']:
                    actual = 'query ok'
                else:
                    actual = 'query fail'
            elif DATA['roleName'] == '':
                counts = uiti.query_one('..\\conf\\base.conf',
                                        'SELECT COUNT(id) FROM system_role ')

                if counts[0] == num['totalRow']:
                    actual = 'query ok'
                else:
                    actual = 'query fail'
        else:
            actual = 'query fail'
        self.assertEqual(actual, expect)
Example #4
0
 def test_system_set(self, set_url, METHOD, DATA, CODE, CONTENT, expect):
     set_data = {'userId': DATA['userId'], 'roleId[]': DATA['roleId[]']}
     resp = System('..\\conf\\base.conf').do_role_set(set_url, set_data)
     content = resp.text
     if content == '角色设置成功':
         actual = 'set ok'
     elif content == '角色设置失败':
         actual = 'set fail'
     self.assertEqual(actual, expect)
Example #5
0
    def test_dic_status(self, status_url, METHOD, DATA, CODE, CONTENT, expect):
        status_data = {'dataId': DATA['dataId'], 'status': DATA['status']}
        resp = System('..\\conf\\base.conf').do_status(status_url, status_data)
        if 'success' in resp.text:
            actual = 'statu ok'
        else:
            actual = 'statu fail'

        self.assertEqual(actual, expect)
Example #6
0
 def test_authorize(self, auth_url, METHOD, DATA, CODE, CONTENT, expect):
     auth_data = {'resId[]': DATA['resId[]'], 'roleId': DATA['roleId']}
     resp = System('..\\conf\\base.conf').do_authorize(auth_url, auth_data)
     content = resp.text
     if content == '授权成功':
         actual = 'authorize ok'
     else:
         actual = 'authorize fail'
     self.assertEqual(actual, expect)
Example #7
0
    def test_role_rolAdd(self, add_url, METHOD, DATA, CODE, CONTENT, expect):
        add_data = {
            'role.name': DATA['role.name'],
            'role.des': DATA['role.des']
        }
        resp = System('..\\conf\\base.conf').do_rolAdd(add_url, add_data)
        if 'success' in resp.text:
            actual = 'add ok'
        else:
            actual = 'add fail'

        self.assertEqual(actual, expect)
Example #8
0
 def test_reset(self, reset_url, METHOD, DATA, CODE, CONTENT, expect):
     reset_data = {
         'userId': DATA['userId'],
         'pwdType': DATA['pwdType'],
         'pwd': DATA['pwd']
     }
     resp = System('..\\conf\\base.conf').do_edit(reset_url, reset_data)
     content = resp.text
     if content == '重置成功':
         actual = 'reset ok'
     elif content == '重置失败':
         actual = 'reset fail'
     self.assertEqual(actual, expect)
Example #9
0
 def test_dic_edit(self, edit_url, METHOD, DATA, CODE, CONTENT, expect):
     edit_data = {
         'dt.dict_type_id': DATA['dt.dict_type_id'],
         'dt.dict_typename': DATA['dt.dict_typename'],
         'dt.remarks': DATA['dt.remarks']
     }
     resp = System('..\\conf\\base.conf').do_dic_ed(edit_url, edit_data)
     content = resp.text
     if content == 'success':
         actual = 'edit ok'
     else:
         actual = 'edit fail'
     self.assertEqual(actual, expect)
Example #10
0
 def test_role_edit(self, edit_url, METHOD, DATA, CODE, CONTENT, expect):
     edit_data = {
         'role.id': DATA['role.id'],
         'role.name': DATA['role.name'],
         'role.des': DATA['role.des']
     }
     resp = System('..\\conf\\base.conf').do_role_edit(edit_url, edit_data)
     content = resp.text
     if content == 'success':
         actual = 'edit ok'
     else:
         actual = 'edit fail'
     self.assertEqual(actual, expect)
Example #11
0
 def test_edit(self, edit_url, METHOD, DATA, CODE, CONTENT, expect):
     edit_data = {
         'user.id': DATA['user.id'],
         'user.name': DATA['user.name'],
         'user.status': DATA['user.status'],
         'user.des': DATA['user.des']
     }
     resp = System('..\\conf\\base.conf').do_edit(edit_url, edit_data)
     content = resp.text
     if content == '修改成功':
         actual = 'edit ok'
     else:
         actual = 'edit fail'
     self.assertEqual(actual, expect)
Example #12
0
    def test_dic_add(self, add_url, METHOD, DATA, CODE, CONTENT, expect):
        add_data = {
            'dd.dict_type_id': DATA['dd.dict_type_id'],
            'dd.dict_value': DATA['dd.dict_value'],
            'dd.dict_key': DATA['dd.dict_key'],
            'dd.sort': DATA['dd.sort'],
            'dd.remarks': DATA['dd.remarks']
        }
        resp = System('..\\conf\\base.conf').do_dicAdd(add_url, add_data)
        if 'success' in resp.text:
            actual = 'add ok'
        else:
            actual = 'add fail'

        self.assertEqual(actual, expect)
Example #13
0
    def test_detail_edit(self, edit_url, METHOD, DATA, CODE, CONTENT, expect):
        edit_data = {
            'dd.dict_type_id': DATA['dd.dict_type_id'],
            'dd.dict_data_id': DATA['dd.dict_data_id'],
            'dict_typename': DATA['dict_typename'],
            'dd.dict_value': DATA['dd.dict_value'],
            'dd.sort': DATA['dd.sort'],
            'dd.remarks': DATA['dd.remarks']
        }
        resp = System('..\\conf\\base.conf').do_detail_ed(edit_url, edit_data)
        if 'success' in resp.text:
            actual = 'edit ok'
        else:
            actual = 'edit fail'

        self.assertEqual(actual, expect)