Test adding invalid attachments fails correctly

This test makes sure that valid attachments don't get left in
the attachments database, so we're able to clean them up during
-compact.