Add tests for media PUT, PATCH and DELETE.

Fixed bug causing wrong ETag computation when inserting new document.