def test_non_default_param_description(self): description = 'This is a custom description' self.param = AutoPopulatedParam(self.name, description) section = self.doc_structure.add_new_section(self.name) section.add_new_section('param-documentation') self.param.document_auto_populated_param('docs.request-params', self.doc_structure) self.assert_contains_line(description)
def test_non_default_param_description(self): description = 'This is a custom description' self.param = AutoPopulatedParam(self.name, description) section = self.doc_structure.add_new_section(self.name) section.add_new_section('param-documentation') self.param.document_auto_populated_param( 'docs.request-params', self.doc_structure) self.assert_contains_line(description)
('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.CreateMultipartUpload', sse_md5), ('before-parameter-build.s3.UploadPart', sse_md5), ('before-parameter-build.s3.UploadPartCopy', sse_md5), ('before-parameter-build.ec2.RunInstances', base64_encode_user_data), ('before-parameter-build.autoscaling.CreateLaunchConfiguration', base64_encode_user_data), ('before-parameter-build.route53', fix_route53_ids), ('before-parameter-build.glacier', inject_account_id), # 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),
def setUp(self): super(TestAutopopulatedParam, self).setUp() self.name = 'MyMember' self.param = AutoPopulatedParam(self.name)
class TestAutopopulatedParam(BaseDocsTest): def setUp(self): super(TestAutopopulatedParam, self).setUp() self.name = 'MyMember' self.param = AutoPopulatedParam(self.name) def test_request_param_not_required(self): section = self.doc_structure.add_new_section(self.name) section.add_new_section('param-documentation') self.param.document_auto_populated_param('docs.request-params', self.doc_structure) self.assert_contains_line('this parameter is automatically populated') def test_request_param_required(self): section = self.doc_structure.add_new_section(self.name) is_required_section = section.add_new_section('is-required') section.add_new_section('param-documentation') is_required_section.write('**[REQUIRED]**') self.param.document_auto_populated_param('docs.request-params', self.doc_structure) self.assert_not_contains_line('**[REQUIRED]**') self.assert_contains_line('this parameter is automatically populated') def test_non_default_param_description(self): description = 'This is a custom description' self.param = AutoPopulatedParam(self.name, description) section = self.doc_structure.add_new_section(self.name) section.add_new_section('param-documentation') self.param.document_auto_populated_param('docs.request-params', self.doc_structure) self.assert_contains_line(description) def test_request_example(self): top_section = self.doc_structure.add_new_section('structure-value') section = top_section.add_new_section(self.name) example = 'MyMember: \'string\'' section.write(example) self.assert_contains_line(example) self.param.document_auto_populated_param('docs.request-example', self.doc_structure) self.assert_not_contains_line(example) def test_param_not_in_section_request_param(self): self.doc_structure.add_new_section('Foo') self.param.document_auto_populated_param('docs.request-params', self.doc_structure) self.assertEqual('', self.doc_structure.flush_structure().decode('utf-8')) def test_param_not_in_section_request_example(self): top_section = self.doc_structure.add_new_section('structure-value') section = top_section.add_new_section('Foo') example = 'Foo: \'string\'' section.write(example) self.assert_contains_line(example) self.param.document_auto_populated_param('docs.request-example', self.doc_structure) self.assert_contains_line(example)
class TestAutopopulatedParam(BaseDocsTest): def setUp(self): super(TestAutopopulatedParam, self).setUp() self.name = 'MyMember' self.param = AutoPopulatedParam(self.name) def test_request_param_not_required(self): section = self.doc_structure.add_new_section(self.name) section.add_new_section('param-documentation') self.param.document_auto_populated_param( 'docs.request-params', self.doc_structure) self.assert_contains_line( 'this parameter is automatically populated') def test_request_param_required(self): section = self.doc_structure.add_new_section(self.name) is_required_section = section.add_new_section('is-required') section.add_new_section('param-documentation') is_required_section.write('**[REQUIRED]**') self.param.document_auto_populated_param( 'docs.request-params', self.doc_structure) self.assert_not_contains_line('**[REQUIRED]**') self.assert_contains_line( 'this parameter is automatically populated') def test_non_default_param_description(self): description = 'This is a custom description' self.param = AutoPopulatedParam(self.name, description) section = self.doc_structure.add_new_section(self.name) section.add_new_section('param-documentation') self.param.document_auto_populated_param( 'docs.request-params', self.doc_structure) self.assert_contains_line(description) def test_request_example(self): top_section = self.doc_structure.add_new_section('structure-value') section = top_section.add_new_section(self.name) example = 'MyMember: \'string\'' section.write(example) self.assert_contains_line(example) self.param.document_auto_populated_param( 'docs.request-example', self.doc_structure) self.assert_not_contains_line(example) def test_param_not_in_section_request_param(self): self.doc_structure.add_new_section('Foo') self.param.document_auto_populated_param( 'docs.request-params', self.doc_structure) self.assertEqual( '', self.doc_structure.flush_structure().decode('utf-8')) def test_param_not_in_section_request_example(self): top_section = self.doc_structure.add_new_section('structure-value') section = top_section.add_new_section('Foo') example = 'Foo: \'string\'' section.write(example) self.assert_contains_line(example) self.param.document_auto_populated_param( 'docs.request-example', self.doc_structure) self.assert_contains_line(example)