Add tests around the loading of settings

Minor refactors, but mostly adding tests to drive out a bug I
encountered while trying to query the settings from the frontend.