Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aws
GitHub Repository: aws/aws-cli
Path: blob/develop/tests/functional/cloudsearch/test_cloudsearch.py
1567 views
1
#!/usr/bin/env python
2
# Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
#
4
# Licensed under the Apache License, Version 2.0 (the "License"). You
5
# may not use this file except in compliance with the License. A copy of
6
# the License is located at
7
#
8
# http://aws.amazon.com/apache2.0/
9
#
10
# or in the "license" file accompanying this file. This file is
11
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
12
# ANY KIND, either express or implied. See the License for the specific
13
# language governing permissions and limitations under the License.
14
from awscli.testutils import BaseAWSCommandParamsTest
15
16
17
class TestCloudSearchDefineExpression(BaseAWSCommandParamsTest):
18
19
prefix = 'cloudsearch define-expression'
20
21
def test_flattened(self):
22
cmdline = self.prefix
23
cmdline += ' --domain-name abc123'
24
cmdline += ' --name foo'
25
cmdline += ' --expression 10'
26
result = {
27
'DomainName': 'abc123',
28
'Expression': {'ExpressionName': 'foo',
29
'ExpressionValue': '10'}}
30
self.assert_params_for_cmd(cmdline, result)
31
32
33
class TestCloudSearchDefineIndexField(BaseAWSCommandParamsTest):
34
35
prefix = 'cloudsearch define-index-field'
36
37
def test_flattened(self):
38
cmdline = self.prefix
39
cmdline += ' --domain-name abc123'
40
cmdline += ' --name foo'
41
cmdline += ' --type int'
42
cmdline += ' --default-value 10'
43
cmdline += ' --search-enabled false'
44
cmdline += ' --source-field fieldname123'
45
result = {
46
'DomainName': 'abc123',
47
'IndexField': {'IndexFieldName': 'foo',
48
'IndexFieldType': 'int',
49
'IntOptions': {'DefaultValue': 10,
50
'SearchEnabled': False,
51
'SourceField': 'fieldname123'}}}
52
self.assert_params_for_cmd(cmdline, result)
53
54
def test_latlon(self):
55
cmdline = self.prefix
56
cmdline += ' --domain-name abc123'
57
cmdline += ' --name foo'
58
cmdline += ' --type latlon'
59
cmdline += ' --default-value 10'
60
cmdline += ' --search-enabled false'
61
cmdline += ' --source-field fieldname123'
62
result = {
63
'DomainName': 'abc123',
64
'IndexField': {
65
'IndexFieldName': 'foo',
66
'IndexFieldType': 'latlon',
67
'LatLonOptions': {
68
'DefaultValue': '10', 'SearchEnabled': False, 'SourceField': 'fieldname123'}}}
69
self.assert_params_for_cmd(cmdline, result)
70
71