Skip to content

Commit 0a5c838

Browse files
author
Wout Feys
committed
Add end2end test for flask_mysql_uwsgi
1 parent 5dd5b36 commit 0a5c838

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

end2end/flask_mysql_uwsgi_test.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import pytest
2+
import requests
3+
# e2e tests for flask_mysql sample app
4+
post_url_fw = "http://localhost:8088/create"
5+
post_url_nofw = "http://localhost:8089/create"
6+
7+
def test_safe_response_with_firewall():
8+
dog_name = "Bobby Tables"
9+
res = requests.post(post_url_fw, data={'dog_name': dog_name})
10+
assert res.status_code == 200
11+
12+
13+
def test_safe_response_without_firewall():
14+
dog_name = "Bobby Tables"
15+
res = requests.post(post_url_nofw, data={'dog_name': dog_name})
16+
assert res.status_code == 200
17+
18+
19+
def test_dangerous_response_with_firewall():
20+
dog_name = 'Dangerous bobby", 1); -- '
21+
res = requests.post(post_url_fw, data={'dog_name': dog_name})
22+
assert res.status_code == 500
23+
24+
def test_dangerous_response_without_firewall():
25+
dog_name = 'Dangerous bobby", 1); -- '
26+
res = requests.post(post_url_nofw, data={'dog_name': dog_name})
27+
assert res.status_code == 200
28+

0 commit comments

Comments
 (0)