File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change
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
+
You can’t perform that action at this time.
0 commit comments