-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
don't default with email addresses but raise Errors
- Loading branch information
Showing
3 changed files
with
15 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -242,11 +242,19 @@ def _get_main(self, config): | |
|
||
self.help_email = config.get('main', 'HELP_EMAIL') | ||
if not self.help_email: | ||
self.help_email = '[email protected]' | ||
raise ValueError( | ||
"You did not specify the HELP_EMAIL address in the main " | ||
"section of Qiita's config file. This address is essential " | ||
"for users to ask for help as it is displayed at various " | ||
"location throughout Qiita's web pages.") | ||
|
||
self.sysadmin_email = config.get('main', 'SYSADMIN_EMAIL') | ||
if not self.sysadmin_email: | ||
self.sysadmin_email = '[email protected]' | ||
raise ValueError( | ||
"You did not specify the SYSADMIN_EMAIL address in the main " | ||
"section of Qiita's config file. Serious issues will " | ||
"automatically be reported to a sys admin, an according " | ||
"address is therefore required!") | ||
|
||
def _get_job_scheduler(self, config): | ||
"""Get the configuration of the job_scheduler section""" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,7 +68,7 @@ COOKIE_SECRET = SECRET | |
# The value used to secure JWTs for delegated permission artifact download. | ||
JWT_SECRET = SUPER_SECRET | ||
|
||
# Address a user should write to when asking for help, default to [email protected] | ||
# Address a user should write to when asking for help | ||
HELP_EMAIL = | ||
|
||
# The email address, Qiita sends internal notifications to a sys admin | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -189,13 +189,13 @@ def test_help_email(self): | |
|
||
# test if it falls back to [email protected] | ||
self.conf.set('main', 'HELP_EMAIL', '') | ||
obs._get_main(self.conf) | ||
self.assertEqual(obs.help_email, '[email protected]') | ||
with self.assertRaises(ValueError): | ||
obs._get_main(self.conf) | ||
|
||
# test if it falls back to [email protected] | ||
self.conf.set('main', 'SYSADMIN_EMAIL', '') | ||
obs._get_main(self.conf) | ||
self.assertEqual(obs.sysadmin_email, '[email protected]') | ||
with self.assertRaises(ValueError): | ||
obs._get_main(self.conf) | ||
|
||
def test_get_job_scheduler(self): | ||
obs = ConfigurationManager() | ||
|