| 1 |
# Copyright 2015 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 |
from boto3.docs.service import ServiceDocumenter |
| 14 |
from boto3.session import Session |
| 15 |
from tests.functional.docs import BaseDocsFunctionalTests |
| 16 |
|
| 17 |
|
| 18 |
class TestS3Customizations(BaseDocsFunctionalTests): |
| 19 |
def setUp(self): |
| 20 |
super().setUp() |
| 21 |
self.documenter = ServiceDocumenter( |
| 22 |
's3', |
| 23 |
session=Session(region_name='us-east-1'), |
| 24 |
root_docs_path=self.root_services_path, |
| 25 |
) |
| 26 |
self.generated_contents = self.documenter.document_service() |
| 27 |
self.generated_contents = self.generated_contents.decode('utf-8') |
| 28 |
|
| 29 |
def test_file_transfer_methods_are_documented(self): |
| 30 |
self.assert_contains_lines_in_order( |
| 31 |
[ |
| 32 |
'=========', |
| 33 |
'Resources', |
| 34 |
'=========', |
| 35 |
'The available resources are:', |
| 36 |
' s3/service-resource/index', |
| 37 |
], |
| 38 |
self.generated_contents, |
| 39 |
) |
| 40 |
self.assert_contains_lines_in_order( |
| 41 |
[ |
| 42 |
'.. py:class:: S3.Client', |
| 43 |
' s3/client/download_file', |
| 44 |
' s3/client/upload_file', |
| 45 |
], |
| 46 |
self.generated_contents, |
| 47 |
) |
| 48 |
self.assert_contains_lines_in_order( |
| 49 |
[ |
| 50 |
'download_file', |
| 51 |
'.. py:method:: S3.Client.download_file(', |
| 52 |
], |
| 53 |
self.get_nested_file_contents('s3', 'client', 'download_file'), |
| 54 |
) |
| 55 |
self.assert_contains_lines_in_order( |
| 56 |
[ |
| 57 |
'upload_file', |
| 58 |
'.. py:method:: S3.Client.upload_file(', |
| 59 |
], |
| 60 |
self.get_nested_file_contents('s3', 'client', 'upload_file'), |
| 61 |
) |