def activate_user(user_id): # 激活用户 fk_user = {"password": "******", "status": 11, "uuid": "0539a37d2e3048b69ef6ec3a00147b19", "is_active": "Y"} MysqlClent.update_dict(DB_CONN, 'fk_user', fk_user, 'id={}'.format(user_id)) manage_user = {"user_status": 11, "available": 1} MysqlClent.update_dict(ManageSql.DB_CONN, 'biz_company_user', manage_user, 'user_id={0} AND company_id={1}'.format(user_id, ManageSql.get_company_id()))
def test_005_company_unlock(self): """ Time :2019-04-02 author : 罗林 desc :启用企业 """ com_id = ManageSql.get_company_id(comp_name) rs4 = m.test_company_unlock(com_id) ass.verity(json.loads(rs4)['message'], '请求成功')
def test_004_company_lock(self): """ Time :2019-04-02 author : 罗林 desc :停用企业 """ com_id = ManageSql.get_company_id(comp_name) rs3 = ManageAction.test_company_lock(com_id) Assertion.verity(json.loads(rs3)['message'], '请求成功')
def test_003_company_detail(self): """ Time :2019-04-02 author : 罗林 desc :获取企业详情 """ com_id = ManageSql.get_company_id(comp_name) rs2 = m.test_company_detail(com_id) ass.verity(json.loads(rs2)['message'], '请求成功') ass.verity(json.loads(rs2)['data']['companyName'], comp_name)
def del_user(): # 删除角色 user_ids = MysqlClent.select_col(DB_CONN, 'fk_user', 'id', 'POSITION("{}" IN name)'.format(loginAction.sign)) MysqlClent.delete(DB_CONN, 'fk_user', 'POSITION("{}" IN name)'.format(loginAction.sign)) for user_id in user_ids: MysqlClent.delete(DB_CONN, 'fk_user_jurisdiction', 'user_id={}'.format(user_id)) condition = 'user_id={0} AND company_id={1}'.format(user_id, ManageSql.get_company_id()) company_user_id = MysqlClent.select_col(ManageSql.DB_CONN, 'biz_company_user', 'id', condition) MysqlClent.delete(ManageSql.DB_CONN, 'biz_company_user', condition) MysqlClent.delete(ManageSql.DB_CONN, 'biz_company_user_device', 'company_user_id IN ({})'.format(tuple(company_user_id)))
def test_008_cuser_save(self): """ Time :2019-04-02 author : 罗林 desc :添加管理员 """ com_id = ManageSql.get_company_id(comp_name) rs3 = m.test_cuser_save(id='', companyid=com_id, username=linkman, userphone=linkphone, useremail=email) ass.verity(json.loads(rs3)['message'], '请求成功')
def test_009_cuser_update(self): """ Time :2019-04-02 author : 罗林 desc :编辑管理员 """ user_id = ManageSql.get_user_id(email) com_id = ManageSql.get_company_id(comp_name) rs5 = m.test_cuser_update(id=user_id, companyid=com_id, username=linkman, userphone=linkphone, useremail=email) ass.verity(json.loads(rs5)['message'], '请求成功')
def test_006_company_update(self): """ Time :2019-04-02 author : 罗林 desc :编辑企业 """ com_id = ManageSql.get_company_id(comp_name) licence_id = ManageSql.get_licence_file_id(comp_name) rs5 = m.test_company_update(id=com_id, name=comp_name, description='apitest-company', linkman=linkman, linkphone=linkphone, licencecode=licence_id, licencefileid=38) ass.verity(json.loads(rs5)['message'], '请求成功')