Fix postgres states with test=True (#12968)

This is my first contribution to salt. Please tell me if something can be improved.