Gateway tests (rebased onto dev_5_0)



This is the same as gh-2571 but rebased onto dev_5_0.

----

Activate tests in gh-2515 by moving them under `test/integration`. The files will need flake8'ing, but the tests should pass which will make the merge of 2515 valid. The fstest here will need another commit to remove the `if False` section that I added to get this in.