Add tests for database state after attachment manipulation

This extends the existing functional tests for attachment CRUD to include checks on the database and file system after completion.