summaryrefslogtreecommitdiff
path: root/tests/test_csrf.py
diff options
context:
space:
mode:
authorTheron Luhn <theron@luhn.com>2019-09-19 18:32:41 -0700
committerTheron Luhn <theron@luhn.com>2019-09-19 18:32:41 -0700
commit6dd21309e4d9b21162b8db3e015533be10db0601 (patch)
treeb032a3aeeeed79fcb6ad1b273bc214147dd0884c /tests/test_csrf.py
parent3af1883bcd617d74eb8c9b134b5ac830f8cdd2a9 (diff)
downloadpyramid-6dd21309e4d9b21162b8db3e015533be10db0601.tar.gz
pyramid-6dd21309e4d9b21162b8db3e015533be10db0601.tar.bz2
pyramid-6dd21309e4d9b21162b8db3e015533be10db0601.zip
Add allow_no_origin option to CSRF.
Diffstat (limited to 'tests/test_csrf.py')
-rw-r--r--tests/test_csrf.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/test_csrf.py b/tests/test_csrf.py
index d1b569c32..f93a1afde 100644
--- a/tests/test_csrf.py
+++ b/tests/test_csrf.py
@@ -363,6 +363,12 @@ class Test_check_csrf_origin(unittest.TestCase):
request.registry.settings = {}
self.assertTrue(self._callFUT(request))
+ def test_success_with_allow_no_origin(self):
+ request = testing.DummyRequest()
+ request.scheme = "https"
+ request.referrer = None
+ self.assertTrue(self._callFUT(request, allow_no_origin=True))
+
def test_fails_with_wrong_host(self):
from pyramid.exceptions import BadCSRFOrigin