File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed
Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change 1+ import warnings
2+
13import pytest
24
35import mellophone
@@ -26,14 +28,18 @@ def test_client_options_are_stored():
2628 assert client .timeout == 7.5
2729
2830
29- def test_client_deprecated_token_aliases_work_and_warn ():
30- with pytest .warns (DeprecationWarning , match = "set_settings_token" ):
31- with pytest .warns (DeprecationWarning , match = "user_manage_token" ):
32- client = mellophone .Mellophone (
33- "http://example.com" ,
34- set_settings_token = "set-token-old" ,
35- user_manage_token = "user-token-old" ,
36- )
31+ def test_client_deprecated_token_aliases ():
32+ with warnings .catch_warnings (record = True ) as caught :
33+ warnings .simplefilter ("always" , DeprecationWarning )
34+ client = mellophone .Mellophone (
35+ "http://example.com" ,
36+ set_settings_token = "set-token-old" ,
37+ user_manage_token = "user-token-old" ,
38+ )
39+
40+ deprecation_messages = [str (item .message ) for item in caught if isinstance (item .message , DeprecationWarning )]
41+ assert any ("set_settings_token" in message for message in deprecation_messages )
42+ assert any ("user_manage_token" in message for message in deprecation_messages )
3743
3844 assert client .token_set_settings == "set-token-old"
3945 assert client .token_user_manage == "user-token-old"
You can’t perform that action at this time.
0 commit comments