Finish testAttachment() test code.
fix null pointer exception when removing attachment.  ApiTest.testAttachment() now passes.