-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Wout Feys
committed
Aug 22, 2024
1 parent
d2dd2d2
commit 6f3e02d
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import pytest | ||
import requests | ||
# e2e tests for flask_postgres sample app | ||
post_url_fw = "http://localhost:8092/xml_post" | ||
post_url_nofw = "http://localhost:8093/xml_post" | ||
|
||
def test_safe_response_with_firewall(): | ||
xml_data = '<dogs><dog dog_name="Bobby" /></dogs>' | ||
res = requests.post(post_url_fw, data=xml_data) | ||
assert res.status_code == 200 | ||
|
||
|
||
def test_safe_response_without_firewall(): | ||
xml_data = '<dogs><dog dog_name="Bobby" /></dogs>' | ||
res = requests.post(post_url_nofw, data=xml_data) | ||
assert res.status_code == 200 | ||
|
||
|
||
def test_dangerous_response_with_firewall(): | ||
xml_data = '<dogs><dog dog_name="Malicious dog\', TRUE); -- " /></dogs>' | ||
res = requests.post(post_url_fw, data=xml_data) | ||
assert res.status_code == 500 | ||
|
||
def test_dangerous_response_without_firewall(): | ||
xml_data = '<dogs><dog dog_name="Malicious dog\', TRUE); -- " /></dogs>' | ||
res = requests.post(post_url_nofw, data=xml_data) | ||
assert res.status_code == 200 | ||
|