class TestHideParamFromOperations(BaseDocsTest):
    def setUp(self):
        super(TestHideParamFromOperations, self).setUp()
        self.name = 'MyMember'
        self.param = HideParamFromOperations('s3', self.name,
                                             ['SampleOperation'])

    def test_hides_params_from_doc_string(self):
        section = self.doc_structure.add_new_section(self.name)
        param_signature = ':param %s: ' % self.name
        section.write(param_signature)
        self.assert_contains_line(param_signature)
        self.param.hide_param(
            'docs.request-params.s3.SampleOperation.complete-section',
            self.doc_structure)
        self.assert_not_contains_line(param_signature)

    def test_hides_param_from_example(self):
        structure = self.doc_structure.add_new_section('structure-value')
        section = structure.add_new_section(self.name)
        example = '%s: \'string\'' % self.name
        section.write(example)
        self.assert_contains_line(example)
        self.param.hide_param(
            'docs.request-example.s3.SampleOperation.complete-section',
            self.doc_structure)
        self.assert_not_contains_line(example)
    ('before-parameter-build.s3.GetObject', sse_md5),
    ('before-parameter-build.s3.PutObject', sse_md5),
    ('before-parameter-build.s3.CopyObject', sse_md5),
    ('before-parameter-build.s3.CopyObject', copy_source_sse_md5),
    ('before-parameter-build.s3.CreateMultipartUpload', sse_md5),
    ('before-parameter-build.s3.UploadPart', sse_md5),
    ('before-parameter-build.s3.UploadPartCopy', sse_md5),
    ('before-parameter-build.s3.UploadPartCopy', copy_source_sse_md5),
    ('before-parameter-build.ec2.RunInstances', base64_encode_user_data),
    ('after-call.s3.ListObjects', decode_list_object),
    ('after-call.s3.ListObjectsV2', decode_list_object_v2),

    # S3 SSE documentation modifications
    ('docs.*.s3.*.complete-section',
     AutoPopulatedParam('SSECustomerKeyMD5').document_auto_populated_param),
    # S3 SSE Copy Source documentation modifications
    ('docs.*.s3.*.complete-section',
     AutoPopulatedParam(
         'CopySourceSSECustomerKeyMD5').document_auto_populated_param),
    # The following S3 operations cannot actually accept a ContentMD5
    ('docs.*.s3.*.complete-section',
     HideParamFromOperations('s3', 'ContentMD5', [
         'DeleteObjects', 'PutBucketAcl', 'PutBucketCors',
         'PutBucketLifecycle', 'PutBucketLogging', 'PutBucketNotification',
         'PutBucketPolicy', 'PutBucketReplication', 'PutBucketRequestPayment',
         'PutBucketTagging', 'PutBucketVersioning', 'PutBucketWebsite',
         'PutObjectAcl'
     ]).hide_param)
]
_add_parameter_aliases(BUILTIN_HANDLERS)
 def setUp(self):
     super(TestHideParamFromOperations, self).setUp()
     self.name = 'MyMember'
     self.param = HideParamFromOperations('s3', self.name,
                                          ['SampleOperation'])