def test_administrative(self, url, method, test_data, resp_code, resp_content, expect): from common.administrative import Administrative query_borlist_resp = Administrative().query_assets(url, test_data) query_borlist_resp_content = query_borlist_resp.json() # print(query_hr_resp_content) print(query_borlist_resp_content['totalRow']) # 通过数据库查询数据的数量 sql = 'select count(*) from borrow;' sql_request = Utility.query_all(data_base_path, sql) print(sql_request[0][0]) if query_borlist_resp_content['totalRow'] == sql_request[0][0]: actual = 'query-success' else: actual = 'query-fail' self.assertEqual(actual, expect)
def test_administrative(self, url, method, test_data, resp_code, resp_content, expect): from common.administrative import Administrative modify_assets_resp = Administrative().modify_assets(url, test_data) modify_assets_resp_content = modify_assets_resp.text # print(modify_hr_resp_content) if modify_assets_resp_content == 'success': actual = 'modify-success' else: actual = 'modify-fail' self.assertEqual(actual, expect)
def test_administrative(self, url, method, test_data, resp_code, resp_content, expect): # 通过数据库查询数据的数量 sql = 'select count(*) from assets;' sql_request = Utility.query_all(data_base_path, sql) from common.administrative import Administrative add_assets_resp =Administrative().add_assets(url, test_data) sql = 'select count(*) from assets;' sql_request1 = Utility.query_all(data_base_path, sql) print(add_assets_resp.text) if int(sql_request[0][0]) == int(sql_request1[0][0]) - 1: actual = 'add-success' elif add_assets_resp.text =='AlreayExistCode': actual = 'add-alreay' else: actual = 'add-fail' self.assertEqual(actual, expect)