From 1bb3ec7968573708df9dc90b91428dc08f6db69f Mon Sep 17 00:00:00 2001 From: nadiraikido <166383531+nadiraikido@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:55:19 +0100 Subject: [PATCH] Remove func --- aikido_zen/sources/flask_test.py | 38 -------------------------------- 1 file changed, 38 deletions(-) diff --git a/aikido_zen/sources/flask_test.py b/aikido_zen/sources/flask_test.py index 89bd184d..36ff94a7 100644 --- a/aikido_zen/sources/flask_test.py +++ b/aikido_zen/sources/flask_test.py @@ -140,44 +140,6 @@ def test_flask_all_3_func_with_invalid_body(): assert calls[2][1]["status_code"] == 404 -def test_flask_all_3_func_with_invalid_body(): - """When the flask body can not be parsed (because it contains invalid json for example), we should still parse the cookies of the endpoint""" - with patch( - "aikido_zen.sources.functions.request_handler.request_handler" - ) as mock_request_handler: - reset_comms() - current_context.set(None) - mock_request_handler.return_value = None - - from flask import Flask - - app = Flask(__name__) - try: - signal.alarm(1) - app(sample_environ_malformed_json, lambda x, y: x) - app.run() - except TimeoutException: - pass - - assert get_current_context().method == "POST" - assert ( - get_current_context().body == None - ) # body is None since it's invalid json - assert get_current_context().headers == { - "COOKIE": "sessionId=abc123xyz456;", - "HEADER_1": "header 1 value", - "HEADER_2": "Header 2 value", - "HOST": "example.com", - "CONTENT_TYPE": "application/json", - } - calls = mock_request_handler.call_args_list - assert len(calls) == 3 - assert calls[0][1]["stage"] == "init" - assert calls[1][1]["stage"] == "pre_response" - assert calls[2][1]["stage"] == "post_response" - assert calls[2][1]["status_code"] == 404 - - def test_flask_all_3_func(): with patch( "aikido_zen.sources.functions.request_handler.request_handler"