File tree Expand file tree Collapse file tree 1 file changed +5
-11
lines changed
Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change 11from base64 import b64encode
2- from unittest .mock import call
2+ from unittest .mock import call , Mock
33
44from flask import url_for
55
@@ -80,15 +80,8 @@ def test_is_logged_in_from_json_request(app, client):
8080
8181
8282def test_logout (app , client , csrf_token_for ):
83- callback_called = []
84-
85- def callback1 ():
86- nonlocal callback_called
87- callback_called .append (True )
88-
89- def callback2 ():
90- nonlocal callback_called
91- callback_called .append (True )
83+ callback1 = Mock ()
84+ callback2 = Mock ()
9285
9386 simplelogin = app .extensions ["simplelogin" ]
9487 simplelogin .register_on_logout_callback (callback1 )
@@ -108,7 +101,8 @@ def callback2():
108101 client .get (url_for ("simplelogin.logout" ))
109102 assert not is_logged_in ()
110103
111- assert callback_called == [True , True ]
104+ callback1 .assert_called_once ()
105+ callback2 .assert_called_once ()
112106
113107
114108def test_flash (app , mocker ):
You can’t perform that action at this time.
0 commit comments