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)
Esempio n. 2
0
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)
Esempio n. 3
0
    # Glacier documentation customizations
    ('docs.*.glacier.*.complete-section',
     AutoPopulatedParam(
         'accountId', 'Note: this parameter is set to "-" by \
                         default if no value is not specified.').
     document_auto_populated_param),
    ('docs.*.glacier.*.complete-section',
     AutoPopulatedParam('checksum').document_auto_populated_param),
    # UserData base64 encoding documentation customizations
    ('docs.*.ec2.RunInstances.complete-section', document_base64_encoding()),
    ('docs.*.autoscaling.CreateLaunchConfiguration.complete-section',
     document_base64_encoding()),
    # EC2 CopySnapshot documentation customizations
    ('docs.*.ec2.CopySnapshot.complete-section',
     AutoPopulatedParam('PresignedUrl').document_auto_populated_param),
    ('docs.*.ec2.CopySnapshot.complete-section',
     AutoPopulatedParam('DestinationRegion').document_auto_populated_param),
    # S3 SSE documentation modifications
    ('docs.*.s3.*.complete-section',
     AutoPopulatedParam('SSECustomerKeyMD5').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)
]
 def setUp(self):
     super(TestHideParamFromOperations, self).setUp()
     self.name = 'MyMember'
     self.param = HideParamFromOperations('s3', self.name,
                                          ['SampleOperation'])
Esempio n. 5
0
 def setUp(self):
     super(TestHideParamFromOperations, self).setUp()
     self.name = 'MyMember'
     self.param = HideParamFromOperations(
         's3', self.name, ['SampleOperation'])