Fix failing tests caused by Cache/Log changes.

Use mocks where possible to make tests simpler and hit the filesystem
less frequently.