@todo Refactor this to get rid of the very integration-style tests.