'Check that nothing goes wrong if we (A) Set up a LibraryContent block
and use it successfully, then (B) Give it an invalid configuration.
No children should be deleted until the configuration is fixed.'

def test_change_after_first_sync(self):

    data_value = 'Hello    world!'
    ItemFactory.create(category='html', parent_location=self.library.location, user_id=self.user.id, publish_item=False, display_name='HTML    BLock', data=data_value)
    with modulestore().default_store(ModuleStoreEnum.Type.split):
        course = CourseFactory.create()
    lc_block = self._add_library_content_block(course, self.lib_key)
    lc_block = self._refresh_children(lc_block)
    self.assertEqual(len(lc_block.children), 1)
    resp = self._update_item(lc_block.location, {'source_library_id': 'library-v1:NOT+FOUND'})
    self.assertEqual(resp.status_code, 200)
    lc_block = modulestore().get_item(lc_block.location)
    self.assertEqual(len(lc_block.children), 1)
    html_block = modulestore().get_item(lc_block.children[0])
    self.assertEqual(html_block.data, data_value)
