Added regression tests for https://issues.infn.it/jira/browse/VOMS-296,%20https://issues.infn.it/jira/browse/VOMS-307