def METHOD_NAME(self):
    with self.assertRaisesMessage(CommandError, 'Must specify exactly one of --courses, --all_courses'):
        self.command.handle(all_courses=True, courses=['some/course/key'])