A Writ of Mandamus looks like it was made for the issue.
"A writ of mandamus is a command issuing from a court of law of competent jurisdiction, in the name of the state or sovereign, directed to some inferior court, officer, corporation, or person, requiring them to do some particular thing therein specified, which appertains to their office or duty."
The Writ of Prohibition is the same type of extraordinary remedy, but to restrain action in excess of legal aurhority. I think one or the other would lie. I'm not a lawyer, though.
If you're interested, this is the contents for the petition.
1. The name of the Plaintiff (petitioner). When proceeding as a plaintiff, the effect is that one has a couse of action and has suffered a tort.
2. The name of the Respondant(s) and his office.
3.The facts of the case.
4.That the Respondant(s) was made aware that their action is mandated.
5. That the Petitioner's notice was ignored and /or refused.
6. The law which mandates the Respondant(s) from commiting the act must be cited.
7. The Petitioner must show that he have a clear legal right to the perition.
8. That no other "plain, speedy, and adequite" remedy exists (the Petitioner has no other remedy and is therefore seeking for an extraordinary one).
9. The relief demanded must be explicit.
10. The Applicant must show if he is seeking for a peremptory or an alternative writ.
11. A return must be sought.
The individuals holding office using these religious tests is breaking the law. I can't see how that fact would not remove the object a court has in "deciding a political question".