'Test that update_item works for a block in a library'

def test_update_item(self):

    library = LibraryFactory.create(modulestore=self.store)
    block = ItemFactory.create(category='html', parent_location=library.location, user_id=self.user_id, publish_item=False, metadata={'data': 'Hello    world'}, modulestore=self.store)
    block_key = block.location
    block.data = 'NEW'
    old_version = self.store.get_item(block_key, remove_version=False, remove_branch=False).location.version_guid
    self.store.update_item(block, self.user_id)
    block = self.store.get_item(block_key)
    self.assertEqual(block.data, 'NEW')
    self.assertEqual(block.location, block_key)
    new_version = self.store.get_item(block_key, remove_version=False, remove_branch=False).location.version_guid
    self.assertNotEqual(old_version, new_version)
