def test_make_file_with_content_overwrite(self):
        """Make file with contentblob and overwite its existing content."""
        name = 'filename.tif'
        hash = self.factory.get_fake_hash()
        storage_key = uuid.uuid4()
        crc = 12345
        size = 100
        deflated_size = 10000
        magic_hash = b'magic_hash'
        f = self.vgw.make_file_with_content
        node1 = f(self.root.id, name, hash, crc, size, deflated_size,
                  storage_key, mimetype='image/tif')
        newhash = self.factory.get_fake_hash('ZZZYYY')
        newstorage_key = uuid.uuid4()
        self.assertNotEqual(newhash, hash)
        self.assertNotEqual(newstorage_key, storage_key)
        f(self.root.id, name, newhash, crc, size,
          deflated_size, newstorage_key, magic_hash=magic_hash)
        node2 = self.vgw.get_node(node1.id, with_content=True)
        self.assertEqual(node2.id, node2.id)
        self.assertEqual(node2.content_hash, newhash)
        self.assertEqual(node2.content.storage_key, newstorage_key)
        self.assertEqual(node2.content.magic_hash, magic_hash)

        # test hashcheck when trying to overwrite with a wrong hash
        self.assertRaises(
            errors.HashMismatch, f, self.root.id, name, newhash, crc, size,
            deflated_size, newstorage_key,
            previous_hash=self.factory.get_fake_hash('ABC'))