From 0c29cf2df41600d3906d521c72991c7686018b71 Mon Sep 17 00:00:00 2001
From: Michael Merickel <michael@merickel.org>
Date: Mon, 15 Oct 2018 16:24:07 +0200
Subject: [PATCH] format source using black

---
 tests/test_csrf.py |   52 ++++++++++++++++++++++++++++++++++------------------
 1 files changed, 34 insertions(+), 18 deletions(-)

diff --git a/tests/test_csrf.py b/tests/test_csrf.py
index a224d92..d1b569c 100644
--- a/tests/test_csrf.py
+++ b/tests/test_csrf.py
@@ -18,6 +18,7 @@
 
     def _makeOne(self):
         from pyramid.csrf import LegacySessionCSRFStoragePolicy
+
         return LegacySessionCSRFStoragePolicy()
 
     def test_register_session_csrf_policy(self):
@@ -37,12 +38,10 @@
         request = DummyRequest(session=self.MockSession())
 
         self.assertEqual(
-            policy.get_csrf_token(request),
-            '02821185e4c94269bdc38e6eeae0a2f8'
+            policy.get_csrf_token(request), '02821185e4c94269bdc38e6eeae0a2f8'
         )
         self.assertEqual(
-            policy.new_csrf_token(request),
-            'e5e9e30a08b34ff9842ff7d2b958c14b'
+            policy.new_csrf_token(request), 'e5e9e30a08b34ff9842ff7d2b958c14b'
         )
 
     def test_check_csrf_token(self):
@@ -56,6 +55,7 @@
 class TestSessionCSRFStoragePolicy(unittest.TestCase):
     def _makeOne(self, **kw):
         from pyramid.csrf import SessionCSRFStoragePolicy
+
         return SessionCSRFStoragePolicy(**kw)
 
     def test_register_session_csrf_policy(self):
@@ -101,6 +101,7 @@
 class TestCookieCSRFStoragePolicy(unittest.TestCase):
     def _makeOne(self, **kw):
         from pyramid.csrf import CookieCSRFStoragePolicy
+
         return CookieCSRFStoragePolicy(**kw)
 
     def test_register_cookie_csrf_policy(self):
@@ -124,8 +125,12 @@
         request.response_callback(request, response)
         self.assertEqual(
             response.headerlist,
-            [('Set-Cookie', 'csrf_token={}; Path=/; SameSite=Lax'.format(
-                token))]
+            [
+                (
+                    'Set-Cookie',
+                    'csrf_token={}; Path=/; SameSite=Lax'.format(token),
+                )
+            ],
         )
 
     def test_get_cookie_csrf_nondefault_samesite(self):
@@ -137,7 +142,7 @@
         request.response_callback(request, response)
         self.assertEqual(
             response.headerlist,
-            [('Set-Cookie', 'csrf_token={}; Path=/'.format(token))]
+            [('Set-Cookie', 'csrf_token={}; Path=/'.format(token))],
         )
 
     def test_existing_cookie_csrf_does_not_set_cookie(self):
@@ -147,10 +152,7 @@
         policy = self._makeOne()
         token = policy.get_csrf_token(request)
 
-        self.assertEqual(
-            token,
-            'e6f325fee5974f3da4315a8ccf4513d2'
-        )
+        self.assertEqual(token, 'e6f325fee5974f3da4315a8ccf4513d2')
         self.assertIsNone(request.response_callback)
 
     def test_new_cookie_csrf_with_existing_cookie_sets_cookies(self):
@@ -164,8 +166,12 @@
         request.response_callback(request, response)
         self.assertEqual(
             response.headerlist,
-            [('Set-Cookie', 'csrf_token={}; Path=/; SameSite=Lax'.format(token)
-            )]
+            [
+                (
+                    'Set-Cookie',
+                    'csrf_token={}; Path=/; SameSite=Lax'.format(token),
+                )
+            ],
         )
 
     def test_get_csrf_token_returns_the_new_token(self):
@@ -189,12 +195,14 @@
         self.assertTrue(policy.check_csrf_token(request, 'foo'))
         self.assertFalse(policy.check_csrf_token(request, 'bar'))
 
+
 class Test_get_csrf_token(unittest.TestCase):
     def setUp(self):
         self.config = testing.setUp()
 
     def _callFUT(self, *args, **kwargs):
         from pyramid.csrf import get_csrf_token
+
         return get_csrf_token(*args, **kwargs)
 
     def test_no_override_csrf_utility_registered(self):
@@ -216,6 +224,7 @@
 
     def _callFUT(self, *args, **kwargs):
         from pyramid.csrf import new_csrf_token
+
         return new_csrf_token(*args, **kwargs)
 
     def test_no_override_csrf_utility_registered(self):
@@ -240,6 +249,7 @@
 
     def _callFUT(self, *args, **kwargs):
         from pyramid.csrf import check_csrf_token
+
         return check_csrf_token(*args, **kwargs)
 
     def test_success_token(self):
@@ -266,9 +276,9 @@
 
     def test_failure_raises(self):
         from pyramid.exceptions import BadCSRFToken
+
         request = testing.DummyRequest()
-        self.assertRaises(BadCSRFToken, self._callFUT, request,
-                          'csrf_token')
+        self.assertRaises(BadCSRFToken, self._callFUT, request, 'csrf_token')
 
     def test_failure_no_raises(self):
         request = testing.DummyRequest()
@@ -282,6 +292,7 @@
 
     def _callFUT(self, *args, **kwargs):
         from pyramid.csrf import check_csrf_token
+
         return check_csrf_token(*args, **kwargs)
 
     def test_success_token(self):
@@ -292,9 +303,9 @@
 
     def test_failure_raises(self):
         from pyramid.exceptions import BadCSRFToken
+
         request = testing.DummyRequest()
-        self.assertRaises(BadCSRFToken, self._callFUT, request,
-                          'csrf_token')
+        self.assertRaises(BadCSRFToken, self._callFUT, request, 'csrf_token')
 
     def test_failure_no_raises(self):
         request = testing.DummyRequest()
@@ -305,6 +316,7 @@
 class Test_check_csrf_origin(unittest.TestCase):
     def _callFUT(self, *args, **kwargs):
         from pyramid.csrf import check_csrf_origin
+
         return check_csrf_origin(*args, **kwargs)
 
     def test_success_with_http(self):
@@ -338,7 +350,7 @@
         request.host_port = "443"
         request.referrer = "https://not-example.com/login/"
         request.registry.settings = {
-            "pyramid.csrf_trusted_origins": ["not-example.com"],
+            "pyramid.csrf_trusted_origins": ["not-example.com"]
         }
         self.assertTrue(self._callFUT(request))
 
@@ -353,6 +365,7 @@
 
     def test_fails_with_wrong_host(self):
         from pyramid.exceptions import BadCSRFOrigin
+
         request = testing.DummyRequest()
         request.scheme = "https"
         request.host = "example.com"
@@ -364,6 +377,7 @@
 
     def test_fails_with_no_origin(self):
         from pyramid.exceptions import BadCSRFOrigin
+
         request = testing.DummyRequest()
         request.scheme = "https"
         request.referrer = None
@@ -372,6 +386,7 @@
 
     def test_fails_when_http_to_https(self):
         from pyramid.exceptions import BadCSRFOrigin
+
         request = testing.DummyRequest()
         request.scheme = "https"
         request.host = "example.com"
@@ -383,6 +398,7 @@
 
     def test_fails_with_nonstandard_port(self):
         from pyramid.exceptions import BadCSRFOrigin
+
         request = testing.DummyRequest()
         request.scheme = "https"
         request.host = "example.com:8080"

--
Gitblit v1.9.3