Refactor some tests to pass on Travis.