@@ -108,9 +108,9 @@ class CustomClass:
108108def test_log_all_should_not_return_apikey_value_by_default (caplog ):
109109 settings = {
110110 "SETTINGS_LOGGING_ENABLED" : True ,
111- "SHUB_APIKEY" : ' apikey_value1' ,
112- "shub_apikey" : ' apikey_value2' ,
113- "api_key" : ' apikey_value3' ,
111+ "SHUB_APIKEY" : " apikey_value1" ,
112+ "shub_apikey" : " apikey_value2" ,
113+ "api_key" : " apikey_value3" ,
114114 }
115115
116116 spider = MockSpider (settings )
@@ -121,13 +121,15 @@ def test_log_all_should_not_return_apikey_value_by_default(caplog):
121121 assert '"SHUB_APIKEY": "**********"' in caplog .text
122122 assert '"shub_apikey": "**********"' in caplog .text
123123 assert '"api_key": "**********"' in caplog .text
124- assert ' apikey_value' not in caplog .text
124+ assert " apikey_value" not in caplog .text
125125
126126
127- def test_log_all_should_return_apikey_value_if_MASKED_SENSITIVE_SETTINGS_ENABLED_is_false (caplog ):
127+ def test_log_all_should_return_apikey_value_if_MASKED_SENSITIVE_SETTINGS_ENABLED_is_false (
128+ caplog ,
129+ ):
128130 settings = {
129131 "SETTINGS_LOGGING_ENABLED" : True ,
130- "APIKEY" : ' apikey_value' ,
132+ "APIKEY" : " apikey_value" ,
131133 "MASKED_SENSITIVE_SETTINGS_ENABLED" : False ,
132134 }
133135
@@ -142,11 +144,11 @@ def test_log_all_should_return_apikey_value_if_MASKED_SENSITIVE_SETTINGS_ENABLED
142144def test_log_all_should_not_return_aws_secret_key_value_by_default (caplog ):
143145 settings = {
144146 "SETTINGS_LOGGING_ENABLED" : True ,
145- "AWS_SECRET_ACCESS_KEY" : ' secret_value1' ,
146- "aws_secret_access_key" : ' secret_value2' ,
147- "aws_access_key" : ' secret_value2' ,
148- "AWS_SECRET_KEY" : ' secret_value2' ,
149- "aws_secret_key" : ' secret_value2' ,
147+ "AWS_SECRET_ACCESS_KEY" : " secret_value1" ,
148+ "aws_secret_access_key" : " secret_value2" ,
149+ "aws_access_key" : " secret_value2" ,
150+ "AWS_SECRET_KEY" : " secret_value2" ,
151+ "aws_secret_key" : " secret_value2" ,
150152 }
151153
152154 spider = MockSpider (settings )
@@ -159,14 +161,14 @@ def test_log_all_should_not_return_aws_secret_key_value_by_default(caplog):
159161 assert '"aws_access_key": "**********"' in caplog .text
160162 assert '"AWS_SECRET_KEY": "**********"' in caplog .text
161163 assert '"aws_secret_key": "**********"' in caplog .text
162- assert ' secret_value' not in caplog .text
164+ assert " secret_value" not in caplog .text
163165
164166
165167def test_log_all_should_not_return_password_value_by_default (caplog ):
166168 settings = {
167169 "SETTINGS_LOGGING_ENABLED" : True ,
168- "test_password" : ' secret_value1' ,
169- "PASSWORD_TEST" : ' secret_value2' ,
170+ "test_password" : " secret_value1" ,
171+ "PASSWORD_TEST" : " secret_value2" ,
170172 }
171173
172174 spider = MockSpider (settings )
@@ -176,22 +178,24 @@ def test_log_all_should_not_return_password_value_by_default(caplog):
176178
177179 assert '"test_password": "**********"' in caplog .text
178180 assert '"PASSWORD_TEST": "**********"' in caplog .text
179- assert ' secret_value' not in caplog .text
181+ assert " secret_value" not in caplog .text
180182
181183
182- def test_log_all_should_return_only_the_custom_regex_data_masked_if_MASKED_SENSITIVE_SETTINGS_REGEX_LIST_configured (caplog ):
184+ def test_log_all_should_return_only_the_custom_regex_data_masked_if_MASKED_SENSITIVE_SETTINGS_REGEX_LIST_configured (
185+ caplog ,
186+ ):
183187 settings = {
184188 "SETTINGS_LOGGING_ENABLED" : True ,
185189 "MASKED_SENSITIVE_SETTINGS_REGEX_LIST" : ["apppppppikey" ],
186- "APIKEY" : ' apikey_value1' ,
187- "apppppppikey" : ' some_random_value' ,
190+ "APIKEY" : " apikey_value1" ,
191+ "apppppppikey" : " some_random_value" ,
188192 }
189193
190194 spider = MockSpider (settings )
191195 logger = SpiderSettingsLogging ()
192196 with caplog .at_level (logging .INFO ):
193197 logger .spider_closed (spider )
194198
195- assert ' apikey_value1' in caplog .text
199+ assert " apikey_value1" in caplog .text
196200 assert '"apppppppikey": "**********"' in caplog .text
197- assert ' some_random_value' not in caplog .text
201+ assert " some_random_value" not in caplog .text
0 commit comments