factor out common test code
factor out common test code


Former-commit-id: dc506c1cb22b5d47e4252508cbf0dd854e305e62 [formerly adc9ce2444ceb9c6a0f1bc3bcfb5bab64c7d20fe]
Former-commit-id: c317c463bf6b346849e1a6cfb95bccf31d8699eb
gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine