Matthew's fixes to the unit tests
Matthew's fixes to the unit tests

Extracted from https://github.com/matrix-org/synapse/pull/2820

matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse