| 1 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 2 |
# |
| 3 |
# Licensed under the Apache License, Version 2.0 (the "License"). You |
| 4 |
# may not use this file except in compliance with the License. A copy of |
| 5 |
# the License is located at |
| 6 |
# |
| 7 |
# https://aws.amazon.com/apache2.0/ |
| 8 |
# |
| 9 |
# or in the "license" file accompanying this file. This file is |
| 10 |
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF |
| 11 |
# ANY KIND, either express or implied. See the License for the specific |
| 12 |
# language governing permissions and limitations under the License. |
| 13 |
|
| 14 |
from boto3.docs.action import PUT_DATA_WARNING_MESSAGE |
| 15 |
from boto3.docs.service import ServiceDocumenter |
| 16 |
from boto3.session import Session |
| 17 |
from tests.functional.docs import BaseDocsFunctionalTests |
| 18 |
|
| 19 |
|
| 20 |
class TestCloudWatchMetricPutActionOverrides(BaseDocsFunctionalTests): |
| 21 |
def setUp(self): |
| 22 |
super().setUp() |
| 23 |
self.documenter = ServiceDocumenter( |
| 24 |
'cloudwatch', |
| 25 |
session=Session(region_name='us-east-1'), |
| 26 |
root_docs_path=self.root_services_path, |
| 27 |
) |
| 28 |
self.generated_contents = self.documenter.document_service() |
| 29 |
self.generated_contents = self.generated_contents.decode('utf-8') |
| 30 |
|
| 31 |
def test_put_action_overrides(self): |
| 32 |
put_action_contents = self.get_nested_file_contents( |
| 33 |
"cloudwatch", "metric", "put_data" |
| 34 |
) |
| 35 |
# first line is an empty string |
| 36 |
self.assert_contains_lines_in_order( |
| 37 |
PUT_DATA_WARNING_MESSAGE.splitlines()[1:], |
| 38 |
put_action_contents, |
| 39 |
) |
| 40 |
|
| 41 |
def test_put_action_override_not_present_in_other_action(self): |
| 42 |
put_alarm_contents = self.get_nested_file_contents( |
| 43 |
"cloudwatch", "metric", "put_alarm" |
| 44 |
) |
| 45 |
for line in PUT_DATA_WARNING_MESSAGE.splitlines()[1:]: |
| 46 |
self.assertNotIn(line, put_alarm_contents) |