Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aws
GitHub Repository: aws/aws-cli
Path: blob/develop/tests/functional/rds/test_modify_option_group.py
1567 views
1
#!/usr/bin/env python
2
# Copyright 2013 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 TestAddOptionGroup(BaseAWSCommandParamsTest):
18
maxDiff = None
19
# This tests the customization where modify-option-group
20
# was split into two commands add-option-group and
21
# remove-option-group. This class is testing add-option-gruop
22
23
prefix = 'rds add-option-to-option-group '
24
25
def test_add_option(self):
26
args = ('--option-group-name myoptiongroup2 '
27
'--options {"OptionName":"TDE"}')
28
cmdline = self.prefix + args
29
result = {'OptionsToInclude': [{'OptionName': 'TDE'}],
30
'OptionGroupName': 'myoptiongroup2'}
31
self.assert_params_for_cmd(cmdline, result)
32
33
def test_option_to_remove_is_not_allowed(self):
34
args = ('--option-group-name myoptiongroup2 '
35
'--options-to-remove foo')
36
cmdline = self.prefix + args
37
self.assert_params_for_cmd(
38
cmdline, expected_rc=255,
39
stderr_contains='Unknown options: --options-to-remove')
40
41
42
class TestRemoveOptionGroup(BaseAWSCommandParamsTest):
43
44
prefix = 'rds remove-option-from-option-group '
45
46
def test_remove_options(self):
47
args = ('--option-group-name myoptiongroup2 '
48
'--options TDE')
49
cmdline = self.prefix + args
50
result = {'OptionsToRemove': ['TDE'],
51
'OptionGroupName': 'myoptiongroup2'}
52
self.assert_params_for_cmd(cmdline, result)
53
54
def test_option_to_add_is_not_allowed(self):
55
args = ('--option-group-name myoptiongroup2 '
56
'--options-to-include {"OptionName":"TDE"}')
57
cmdline = self.prefix + args
58
self.assert_params_for_cmd(
59
cmdline, expected_rc=255,
60
stderr_contains='Unknown options: --options-to-include')
61
62