text: import elasticsearch
  import curator
  import os
  import json
  import string, random, tempfile
  import click
  from click import testing as clicktest
  from mock import patch, Mock
  
  from . import CuratorTestCase
  from . import testvars as testvars
  
  import logging
  logger = logging.getLogger(__name__)
  
  host, port = os.environ.get('TEST_ES_SERVER', 'localhost:9200').split(':')
  port = int(port) if port else 9200
  
  
  class TestCLIClusterRouting(CuratorTestCase):
      def test_allocation_all(self):
          routing_type = 'allocation'
          value = 'all'
          self.write_config(
              self.args['configfile'], testvars.client_config.format(host, port))
          self.write_config(self.args['actionfile'],
              testvars.cluster_routing_test.format(routing_type, value))
          self.create_index('my_index')
          self.create_index('not_my_index')
          test = clicktest.CliRunner()
          result = test.invoke(
                      curator.cli,
                      [
                          '--config', self.args['configfile'],
                          self.args['actionfile']
                      ],
                      )
  
          self.assertEquals(testvars.CRA_all,
              self.client.cluster.get_settings())
      def test_extra_option(self):
          self.write_config(
              self.args['configfile'], testvars.client_config.format(host, port))
          self.write_config(self.args['actionfile'],
              testvars.bad_option_proto_test.format('cluster_routing'))
          self.create_index('my_index')
          self.create_index('not_my_index')
          test = clicktest.CliRunner()
          result = test.invoke(
                      curator.cli,
                      [
                          '--config', self.args['configfile'],
                          self.args['actionfile']
                      ],
                      )
          self.assertEqual(-1, result.exit_code)
  