Reduce duplicated code in quote tests