Initial work towards the fix.
Fixes https://issues.infn.it/jira/browse/VOMS-509
Reformatted tests.