Skip to content

Commit fd0e9f7

Browse files
committed
don't default with email addresses but raise Errors
1 parent cae7fc7 commit fd0e9f7

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

qiita_core/configuration_manager.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,19 @@ def _get_main(self, config):
242242

243243
self.help_email = config.get('main', 'HELP_EMAIL')
244244
if not self.help_email:
245-
self.help_email = '[email protected]'
245+
raise ValueError(
246+
"You did not specify the HELP_EMAIL address in the main "
247+
"section of Qiita's config file. This address is essential "
248+
"for users to ask for help as it is displayed at various "
249+
"location throughout Qiita's web pages.")
246250

247251
self.sysadmin_email = config.get('main', 'SYSADMIN_EMAIL')
248252
if not self.sysadmin_email:
249-
self.sysadmin_email = '[email protected]'
253+
raise ValueError(
254+
"You did not specify the SYSADMIN_EMAIL address in the main "
255+
"section of Qiita's config file. Serious issues will "
256+
"automatically be reported to a sys admin, an according "
257+
"address is therefore required!")
250258

251259
def _get_job_scheduler(self, config):
252260
"""Get the configuration of the job_scheduler section"""

qiita_core/support_files/config_test.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ COOKIE_SECRET = SECRET
6868
# The value used to secure JWTs for delegated permission artifact download.
6969
JWT_SECRET = SUPER_SECRET
7070

71-
# Address a user should write to when asking for help, default to [email protected]
71+
# Address a user should write to when asking for help
7272
HELP_EMAIL =
7373

7474
# The email address, Qiita sends internal notifications to a sys admin

qiita_core/tests/test_configuration_manager.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,13 @@ def test_help_email(self):
189189

190190
# test if it falls back to [email protected]
191191
self.conf.set('main', 'HELP_EMAIL', '')
192-
obs._get_main(self.conf)
193-
self.assertEqual(obs.help_email, '[email protected]')
192+
with self.assertRaises(ValueError):
193+
obs._get_main(self.conf)
194194

195195
# test if it falls back to [email protected]
196196
self.conf.set('main', 'SYSADMIN_EMAIL', '')
197-
obs._get_main(self.conf)
198-
self.assertEqual(obs.sysadmin_email, '[email protected]')
197+
with self.assertRaises(ValueError):
198+
obs._get_main(self.conf)
199199

200200
def test_get_job_scheduler(self):
201201
obs = ConfigurationManager()

0 commit comments

Comments
 (0)