Deduplicate the settings test code