Any officer or person who is removed or threatened with removal from any office or position of public trust may bring an action to restrain such unlawful removal or to enforce restoration by process of injunction, both prohibitory and mandatory, if the real reason for the removal or threat thereof is noncompliance with provisions requiring such additional test or qualification or the refusal to require any additional test or qualification in the appointment to a position of public trust.