class TestTraverseAndDocumentShape(BaseParamsDocumenterTest): def setUp(self): super(TestTraverseAndDocumentShape, self).setUp() self.add_shape_to_params('Foo', 'String', 'This describes foo.') self.event_emitter = mock.Mock() self.request_params = RequestParamsDocumenter( service_name='myservice', operation_name='SampleOperation', event_emitter=self.event_emitter) self.response_params = ResponseParamsDocumenter( service_name='myservice', operation_name='SampleOperation', event_emitter=self.event_emitter) def test_events_emitted_response_params(self): self.response_params.traverse_and_document_shape( section=self.doc_structure, shape=self.operation_model.input_shape, history=[]) self.assertEqual(self.event_emitter.emit.call_args_list, [ mock.call('docs.response-params.myservice.SampleOperation.Foo', section=self.doc_structure.get_section('Foo')), mock.call(('docs.response-params.myservice.SampleOperation' '.complete-section'), section=self.doc_structure) ]) def test_events_emitted_request_params(self): self.request_params.traverse_and_document_shape( section=self.doc_structure, shape=self.operation_model.input_shape, history=[]) self.assertEqual(self.event_emitter.emit.call_args_list, [ mock.call('docs.request-params.myservice.SampleOperation.Foo', section=self.doc_structure.get_section('Foo')), mock.call(('docs.request-params.myservice.SampleOperation' '.complete-section'), section=self.doc_structure) ])
class TestTraverseAndDocumentShape(BaseParamsDocumenterTest): def setUp(self): super(TestTraverseAndDocumentShape, self).setUp() self.add_shape_to_params('Foo', 'String', 'This describes foo.') self.event_emitter = mock.Mock() self.request_params = RequestParamsDocumenter( service_name='myservice', operation_name='SampleOperation', event_emitter=self.event_emitter) self.response_params = ResponseParamsDocumenter( service_name='myservice', operation_name='SampleOperation', event_emitter=self.event_emitter) def test_events_emitted_response_params(self): self.response_params.traverse_and_document_shape( section=self.doc_structure, shape=self.operation_model.input_shape, history=[] ) self.assertEqual( self.event_emitter.emit.call_args_list, [mock.call('docs.response-params.myservice.SampleOperation.Foo', section=self.doc_structure.get_section('Foo')), mock.call(('docs.response-params.myservice.SampleOperation' '.complete-section'), section=self.doc_structure)] ) def test_events_emitted_request_params(self): self.request_params.traverse_and_document_shape( section=self.doc_structure, shape=self.operation_model.input_shape, history=[] ) self.assertEqual( self.event_emitter.emit.call_args_list, [mock.call('docs.request-params.myservice.SampleOperation.Foo', section=self.doc_structure.get_section('Foo')), mock.call(('docs.request-params.myservice.SampleOperation' '.complete-section'), section=self.doc_structure)] )