Skip to content

Commit

Permalink
Remove func
Browse files Browse the repository at this point in the history
  • Loading branch information
kapyteinaikido authored and bitterpanda63 committed Dec 20, 2024
1 parent 4277621 commit 1bb3ec7
Showing 1 changed file with 0 additions and 38 deletions.
38 changes: 0 additions & 38 deletions aikido_zen/sources/flask_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 1bb3ec7

Please sign in to comment.