Path: blob/develop/tests/functional/cloudsearch/test_cloudsearch.py
1567 views
#!/usr/bin/env python1# Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.2#3# Licensed under the Apache License, Version 2.0 (the "License"). You4# may not use this file except in compliance with the License. A copy of5# the License is located at6#7# http://aws.amazon.com/apache2.0/8#9# or in the "license" file accompanying this file. This file is10# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF11# ANY KIND, either express or implied. See the License for the specific12# language governing permissions and limitations under the License.13from awscli.testutils import BaseAWSCommandParamsTest141516class TestCloudSearchDefineExpression(BaseAWSCommandParamsTest):1718prefix = 'cloudsearch define-expression'1920def test_flattened(self):21cmdline = self.prefix22cmdline += ' --domain-name abc123'23cmdline += ' --name foo'24cmdline += ' --expression 10'25result = {26'DomainName': 'abc123',27'Expression': {'ExpressionName': 'foo',28'ExpressionValue': '10'}}29self.assert_params_for_cmd(cmdline, result)303132class TestCloudSearchDefineIndexField(BaseAWSCommandParamsTest):3334prefix = 'cloudsearch define-index-field'3536def test_flattened(self):37cmdline = self.prefix38cmdline += ' --domain-name abc123'39cmdline += ' --name foo'40cmdline += ' --type int'41cmdline += ' --default-value 10'42cmdline += ' --search-enabled false'43cmdline += ' --source-field fieldname123'44result = {45'DomainName': 'abc123',46'IndexField': {'IndexFieldName': 'foo',47'IndexFieldType': 'int',48'IntOptions': {'DefaultValue': 10,49'SearchEnabled': False,50'SourceField': 'fieldname123'}}}51self.assert_params_for_cmd(cmdline, result)5253def test_latlon(self):54cmdline = self.prefix55cmdline += ' --domain-name abc123'56cmdline += ' --name foo'57cmdline += ' --type latlon'58cmdline += ' --default-value 10'59cmdline += ' --search-enabled false'60cmdline += ' --source-field fieldname123'61result = {62'DomainName': 'abc123',63'IndexField': {64'IndexFieldName': 'foo',65'IndexFieldType': 'latlon',66'LatLonOptions': {67'DefaultValue': '10', 'SearchEnabled': False, 'SourceField': 'fieldname123'}}}68self.assert_params_for_cmd(cmdline, result)697071