def test_login(self, cases): for caseName, caseInfo in cases.items(): caseName = caseName data = json.dumps(caseInfo["data"]) check = caseInfo["check"] self.__dict__['_testMethodDoc'] = caseName # 发送请求 print(data) print(type(data)) response = sendRequest(self.method, self.url, self.headers, data) # 接口返回文本信息 text = response.text text_dict = json.loads(text) # 写日志 writeLog(caseName, self.url, data, check, text) # 断言 Check().check(check, text_dict) @classmethod def tearDownClass(cls): pass
def __init__(self, configuration: Configuration, configuration_key: str, connection: Connection): if not connection.has_bigquery() and not connection.has_orm(): raise ConfigurationMissingError( 'Missing a database configuration for this operation') self.configuration = configuration self.module_configuration = configuration.operations.get_custom_configuration_operation( configuration_key) self.mongodb = connection.mongodb self.check_service = Check(connection)
def test_Login(self, cases): for caseName, caseInfo in cases.items(): caseName = caseName data = caseInfo["data"] check = caseInfo["check"] self.__dict__['_testMethodDoc'] = caseName data['modifiedUserId'] = user_id data['applyDate'] = str(datetime.datetime.utcnow().isoformat()) data['description'] = str(caseName) # 发送请求 response = sendRequest(self.method, self.url, self.headers, json.dumps(data)) # 接口返回文本信息 text = response.text text_dict = json.loads(text) # 写日志 writeLog(caseName, self.url, data, check, text) # 断言 Check().check_bill(check, text_dict)