@@ -711,7 +711,7 @@ def test_request_suspicious_request_block_match_uri(
711711 assert self .status (response ) == 403
712712 assert get_entry_span_tag (http .STATUS_CODE ) == "403"
713713 block_id = self .check_single_rule_triggered ("tst-037-002" , entry_span )
714- assert self .body (response ) == constants .BLOCKED_RESPONSE_JSON . replace ( SECID , f'" { block_id } "' )
714+ assert self .body (response ) == _format_template ( constants .BLOCKED_RESPONSE_JSON , block_id )
715715 assert (
716716 get_entry_span_tag (asm_constants .SPAN_DATA_NAMES .RESPONSE_HEADERS_NO_COOKIES + ".content-type" )
717717 == "application/json"
@@ -774,7 +774,7 @@ def test_request_suspicious_request_block_match_path_params(
774774 assert self .status (response ) == 403
775775 assert get_entry_span_tag (http .STATUS_CODE ) == "403"
776776 block_id = self .check_single_rule_triggered ("tst-037-007" , entry_span )
777- assert self .body (response ) == constants .BLOCKED_RESPONSE_JSON . replace ( SECID , f'" { block_id } "' )
777+ assert self .body (response ) == _format_template ( constants .BLOCKED_RESPONSE_JSON , block_id )
778778 assert (
779779 get_entry_span_tag (asm_constants .SPAN_DATA_NAMES .RESPONSE_HEADERS_NO_COOKIES + ".content-type" )
780780 == "application/json"
@@ -818,7 +818,7 @@ def test_request_suspicious_request_block_match_query_params(
818818 assert self .status (response ) == 403
819819 assert get_entry_span_tag (http .STATUS_CODE ) == "403"
820820 block_id = self .check_single_rule_triggered ("tst-037-001" , entry_span )
821- assert self .body (response ) == constants .BLOCKED_RESPONSE_JSON . replace ( SECID , f'" { block_id } "' )
821+ assert self .body (response ) == _format_template ( constants .BLOCKED_RESPONSE_JSON , block_id )
822822 assert (
823823 get_entry_span_tag (asm_constants .SPAN_DATA_NAMES .RESPONSE_HEADERS_NO_COOKIES + ".content-type" )
824824 == "application/json"
@@ -857,7 +857,7 @@ def test_request_suspicious_request_block_match_request_headers(
857857 assert self .status (response ) == 403
858858 assert get_entry_span_tag (http .STATUS_CODE ) == "403"
859859 block_id = self .check_single_rule_triggered ("tst-037-004" , entry_span )
860- assert self .body (response ) == constants .BLOCKED_RESPONSE_JSON . replace ( SECID , f'" { block_id } "' )
860+ assert self .body (response ) == _format_template ( constants .BLOCKED_RESPONSE_JSON , block_id )
861861 assert (
862862 get_entry_span_tag (asm_constants .SPAN_DATA_NAMES .RESPONSE_HEADERS_NO_COOKIES + ".content-type" )
863863 == "application/json"
@@ -896,7 +896,7 @@ def test_request_suspicious_request_block_match_request_cookies(
896896 assert self .status (response ) == 403
897897 assert get_entry_span_tag (http .STATUS_CODE ) == "403"
898898 block_id = self .check_single_rule_triggered ("tst-037-008" , entry_span )
899- assert self .body (response ) == constants .BLOCKED_RESPONSE_JSON . replace ( SECID , f'" { block_id } "' )
899+ assert self .body (response ) == _format_template ( constants .BLOCKED_RESPONSE_JSON , block_id )
900900 assert (
901901 get_entry_span_tag (asm_constants .SPAN_DATA_NAMES .RESPONSE_HEADERS_NO_COOKIES + ".content-type" )
902902 == "application/json"
@@ -939,7 +939,7 @@ def test_request_suspicious_request_block_match_response_status(
939939 assert self .status (response ) == 403
940940 assert get_entry_span_tag (http .STATUS_CODE ) == "403"
941941 block_id = self .check_single_rule_triggered (blocked , entry_span )
942- assert self .body (response ) == constants .BLOCKED_RESPONSE_JSON . replace ( SECID , f'" { block_id } "' )
942+ assert self .body (response ) == _format_template ( constants .BLOCKED_RESPONSE_JSON , block_id )
943943 assert (
944944 get_entry_span_tag (asm_constants .SPAN_DATA_NAMES .RESPONSE_HEADERS_NO_COOKIES + ".content-type" )
945945 == "application/json"
@@ -992,7 +992,7 @@ def test_request_suspicious_request_block_match_response_headers(
992992 assert self .status (response ) == 403
993993 assert get_entry_span_tag (http .STATUS_CODE ) == "403"
994994 block_id = self .check_single_rule_triggered (blocked , entry_span )
995- assert self .body (response ) == constants .BLOCKED_RESPONSE_JSON . replace ( SECID , f'" { block_id } "' )
995+ assert self .body (response ) == _format_template ( constants .BLOCKED_RESPONSE_JSON , block_id )
996996 assert (
997997 get_entry_span_tag (asm_constants .SPAN_DATA_NAMES .RESPONSE_HEADERS_NO_COOKIES + ".content-type" )
998998 == "application/json"
@@ -1063,7 +1063,7 @@ def test_request_suspicious_request_block_match_request_body(
10631063 assert self .status (response ) == 403
10641064 assert get_entry_span_tag (http .STATUS_CODE ) == "403"
10651065 block_id = self .check_single_rule_triggered (blocked , entry_span )
1066- assert self .body (response ) == constants .BLOCKED_RESPONSE_JSON . replace ( SECID , f'" { block_id } "' )
1066+ assert self .body (response ) == _format_template ( constants .BLOCKED_RESPONSE_JSON , block_id )
10671067 assert (
10681068 get_entry_span_tag (asm_constants .SPAN_DATA_NAMES .RESPONSE_HEADERS_NO_COOKIES + ".content-type" )
10691069 == "application/json"
0 commit comments