S3 tests

Here are some tests for the S3 module.  Production code hasn't changed, but TDD'd it back in.

I think the S3 stuff needs the same open-closed refactor as that happened to the database.