'Test that raises CommandError if course key is passed'

def test_given_course_key_raises_command_error(self):

    with self.assertRaisesRegexp(CommandError, '.*    is    not    a    library    key'):
        call_command('reindex_library', unicode(self.first_course.id))
    with self.assertRaisesRegexp(CommandError, '.*    is    not    a    library    key'):
        call_command('reindex_library', unicode(self.second_course.id))
    with self.assertRaisesRegexp(CommandError, '.*    is    not    a    library    key'):
        call_command('reindex_library', unicode(self.second_course.id), unicode(self._get_lib_key(self.first_lib)))
