def test_validate_ng_method1_length(self): """ バリデーション ※ 異常系(extraction_method1文字列上限を超過) """ method_val = ( "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" ) json_str = ('{"json_str": [' '{"ope": "1",' ' "match_id": "999",' ' "ita_driver_id": "999",' ' "menu_id": "999",' ' "parameter_name": "ホスト名",' ' "order": "0",' ' "conditional_name": "メッセージ本文",' ' "extraction_method1": "%s",' ' "extraction_method2": "",' ' "row_id": "1"}]}') % (method_val) json_str = json.loads(json_str) records = json_str['json_str'] version = 1 request = None error_flag, error_msg = _validate(records, version, request) assert 'MOSJA27323' in error_msg['1']['extraction_method1']
def test_validate_ng_parametername_empty(self): """ バリデーション ※ 異常系(parameter_name) """ json_str = ( '{"json_str": [' '{"ope": "1",' ' "match_id": "999",' ' "ita_driver_id": "999",' ' "menu_id": "999",' ' "parameter_name": "",' ' "order": "0",' ' "conditional_name": "メッセージ本文",' ' "extraction_method1": "(?<=(対象ノード|対象ホスト)= )[a-zA-Z0-9_-]+",' ' "extraction_method2": "",' ' "row_id": "1"}]}') json_str = json.loads(json_str) records = json_str['json_str'] version = 1 request = None error_flag, error_msg = _validate(records, version, request) assert 'MOSJA27318' in error_msg['1']['parameter_name']
def test_validate_ng_conditionalname_length(self): """ バリデーション ※ 異常系(conditional_name文字列上限を超過) """ json_str = ( '{"json_str": [' '{"ope": "1",' ' "match_id": "999",' ' "ita_driver_id": "999",' ' "menu_id": "999",' ' "parameter_name": "ホスト名",' ' "order": "0",' ' "conditional_name": "1234567890123456789012345678901234567890",' ' "extraction_method1": "(?<=(対象ノード|対象ホスト)= )[a-zA-Z0-9_-]+",' ' "extraction_method2": "",' ' "row_id": "1"}]}') json_str = json.loads(json_str) records = json_str['json_str'] version = 1 request = None error_flag, error_msg = _validate(records, version, request) assert 'MOSJA27322' in error_msg['1']['conditional_name']
def test_validate_ok(self): """ バリデーション ※ 正常系 """ json_str = ( '{"json_str": [' '{"ope": "1",' ' "match_id": "999",' ' "ita_driver_id": "999",' ' "menu_id": "999",' ' "parameter_name": "ホスト名",' ' "order": "0",' ' "conditional_name": "メッセージ本文",' ' "extraction_method1": "(?<=(対象ノード|対象ホスト)= )[a-zA-Z0-9_-]+",' ' "extraction_method2": "",' ' "row_id": "1"}]}') json_str = json.loads(json_str) records = json_str['json_str'] version = 1 request = None error_flag, error_msg = _validate(records, version, request) assert error_flag == False