File tree Expand file tree Collapse file tree 3 files changed +84
-0
lines changed Expand file tree Collapse file tree 3 files changed +84
-0
lines changed Original file line number Diff line number Diff line change
1
+ import pytest
2
+ import requests
3
+ # e2e tests for django_mysql_gunicorn sample app
4
+ post_url_fw = "http://localhost:8082/app/create/"
5
+ post_url_nofw = "http://localhost:8083/app/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
+
Original file line number Diff line number Diff line change
1
+ import pytest
2
+ import requests
3
+ # e2e tests for django_mysql sample app
4
+ post_url_fw = "http://localhost:8080/app/create"
5
+ post_url_nofw = "http://localhost:8081/app/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
+
Original file line number Diff line number Diff line change
1
+ import pytest
2
+ import requests
3
+ # e2e tests for flask_postgres sample app
4
+ post_url_fw = "http://localhost:8090/create"
5
+ post_url_nofw = "http://localhost:8091/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', TRUE); -- "
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', TRUE); -- "
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