Security and API keys should be renewed periodically. This additional notification should help admins keep their Discourse safe and secure.
Could probably do
Could save a line here with:
next if site_setting&.value.blank?
I don’t think we should be testing private methods. A test should stick to the public API surface because this prevents us from refactoring in the future.
In this case I would recommend moving the
old_xxx methods to
SiteSetting as public and testing using those.
body etc you can look for the post that was created after the job finishes.
@eviltrout thank you for the feedback. I fixed it. I think that old keys setting is very specific to this problem, so I didn’t want to move that to SiteSettings model. Instead, I extended the test for “execute” method so there is no more need to test private methods.
Minor but instead of two intermediate arrays, because we can just push into an existing array?
Thank you! nice catch, fixed and I will merge that stuff tomorrow in the morning
Btw I left a small comment in dev about the design of this feature in https://dev.discourse.org/t/automatic-reminder-to-reset-old-machine-generated-secrets/16311/9