@@ -185,6 +185,7 @@ def test_no_user_loader_raises(self):
185
185
class MethodViewLoginTestCase (unittest .TestCase ):
186
186
def setUp (self ):
187
187
self .app = Flask (__name__ )
188
+ self .app .config ["SECRET_KEY" ] = "deterministic"
188
189
self .login_manager = LoginManager ()
189
190
self .login_manager .init_app (self .app )
190
191
@@ -709,9 +710,7 @@ def test_set_cookie_with_invalid_custom_duration_raises_exception(self):
709
710
with self .app .test_request_context ():
710
711
login_user (notch , remember = True , duration = "123" )
711
712
712
- expected_exception_message = (
713
- "duration must be a datetime.timedelta, instead got: 123"
714
- )
713
+ expected_exception_message = "duration must be a datetime.timedelta, instead got: 123"
715
714
self .assertIn (expected_exception_message , str (cm .exception ))
716
715
717
716
def test_remember_me_no_refresh_every_request (self ):
@@ -732,7 +731,7 @@ def test_remember_me_refresh_each_request(self):
732
731
now = datetime .now (timezone .utc )
733
732
mock_dt .now = Mock (return_value = now )
734
733
735
- domain = self .app .config ["REMEMBER_COOKIE_DOMAIN" ] = "localhost.local "
734
+ domain = self .app .config ["REMEMBER_COOKIE_DOMAIN" ] = "localhost"
736
735
path = self .app .config ["REMEMBER_COOKIE_PATH" ] = "/"
737
736
self .app .config ["REMEMBER_COOKIE_REFRESH_EACH_REQUEST" ] = True
738
737
c = self .app .test_client ()
@@ -886,9 +885,7 @@ def test_user_login_confirmed_signal_fired(self):
886
885
def test_session_not_modified (self ):
887
886
with self .app .test_client () as c :
888
887
# Within the request we think we didn't modify the session.
889
- self .assertEqual (
890
- "modified=False" , c .get ("/empty_session" ).data .decode ("utf-8" )
891
- )
888
+ self .assertEqual ("modified=False" , c .get ("/empty_session" ).data .decode ("utf-8" ))
892
889
# But after the request, the session could be modified by the
893
890
# "after_request" handlers that call _update_remember_cookie.
894
891
# Ensure that if nothing changed the session is not modified.
@@ -1260,25 +1257,19 @@ def test_make_next_param(self):
1260
1257
url = make_next_param ("https://localhost/login" , "http://localhost/profile" )
1261
1258
self .assertEqual ("http://localhost/profile" , url )
1262
1259
1263
- url = make_next_param (
1264
- "http://accounts.localhost/login" , "http://localhost/profile"
1265
- )
1260
+ url = make_next_param ("http://accounts.localhost/login" , "http://localhost/profile" )
1266
1261
self .assertEqual ("http://localhost/profile" , url )
1267
1262
1268
1263
def test_login_url_generation (self ):
1269
1264
with self .app .test_request_context ():
1270
1265
PROTECTED = "http://localhost/protected"
1271
1266
1272
- self .assertEqual (
1273
- "/login?n=%2Fprotected" , login_url ("/login" , PROTECTED , "n" )
1274
- )
1267
+ self .assertEqual ("/login?n=%2Fprotected" , login_url ("/login" , PROTECTED , "n" ))
1275
1268
1276
1269
url = login_url ("/login" , PROTECTED )
1277
1270
self .assertEqual ("/login?next=%2Fprotected" , url )
1278
1271
1279
- expected = (
1280
- "https://auth.localhost/login?next=http%3A%2F%2Flocalhost%2Fprotected"
1281
- )
1272
+ expected = "https://auth.localhost/login?next=http%3A%2F%2Flocalhost%2Fprotected"
1282
1273
result = login_url ("https://auth.localhost/login" , PROTECTED )
1283
1274
self .assertEqual (expected , result )
1284
1275
@@ -1290,9 +1281,7 @@ def test_login_url_generation(self):
1290
1281
1291
1282
def test_login_url_generation_with_view (self ):
1292
1283
with self .app .test_request_context ():
1293
- self .assertEqual (
1294
- "/login?next=%2Fprotected" , login_url ("login" , "/protected" )
1295
- )
1284
+ self .assertEqual ("/login?next=%2Fprotected" , login_url ("login" , "/protected" ))
1296
1285
1297
1286
def test_login_url_no_next_url (self ):
1298
1287
self .assertEqual (login_url ("/foo" ), "/foo" )
0 commit comments