'Test that the validation method of LibraryContent blocks can validate
the source_library setting.'

def test_validation_of_course_libraries(self):

    self.lc_block.source_library_id = ''
    result = self.lc_block.validate()
    self.assertFalse(result)
    self.assertTrue(result.summary)
    self.assertEqual(StudioValidationMessage.NOT_CONFIGURED, result.summary.type)
    self.lc_block.source_library_id = 'library-v1:BAD+WOLF'
    result = self.lc_block.validate()
    self.assertFalse(result)
    self.assertTrue(result.summary)
    self.assertEqual(StudioValidationMessage.ERROR, result.summary.type)
    self.assertIn('invalid', result.summary.text)
    self.lc_block.source_library_id = unicode(self.library.location.library_key)
    result = self.lc_block.validate()
    self.assertFalse(result)
    self.assertTrue(result.summary)
    self.assertEqual(StudioValidationMessage.WARNING, result.summary.type)
    self.assertIn('out    of    date', result.summary.text)
    self.lc_block.refresh_children()
    self.assertTrue(self.lc_block.validate())
