def setUp(self): self.root_dir = tempfile.mkdtemp() self.version_dirs = os.path.join(self.root_dir, 'myservice', '2014-01-01') os.makedirs(self.version_dirs) self.model_file = os.path.join(self.version_dirs, 'service-2.json') self.waiter_model_file = os.path.join(self.version_dirs, 'waiters-2.json') self.paginator_model_file = os.path.join(self.version_dirs, 'paginators-1.json') self.resource_model_file = os.path.join(self.version_dirs, 'resources-1.json') self.example_model_file = os.path.join(self.version_dirs, 'examples-1.json') self.json_model = {} self.waiter_json_model = {} self.paginator_json_model = {} self.resource_json_model = {} self._setup_models() self._write_models() self.doc_name = 'MyDoc' self.doc_structure = DocumentStructure(self.doc_name) self.loader = Loader(extra_search_paths=[self.root_dir]) self.botocore_session = botocore.session.get_session() self.botocore_session.register_component('data_loader', self.loader) self.session = Session(botocore_session=self.botocore_session, region_name='us-east-1') self.client = self.session.client('myservice', 'us-east-1') self.resource = self.session.resource('myservice', 'us-east-1')
def setUp(self): self.root_dir = tempfile.mkdtemp() self.version_dirs = os.path.join( self.root_dir, 'myservice', '2014-01-01') os.makedirs(self.version_dirs) self.model_file = os.path.join(self.version_dirs, 'service-2.json') self.waiter_model_file = os.path.join( self.version_dirs, 'waiters-2.json') self.paginator_model_file = os.path.join( self.version_dirs, 'paginators-1.json') self.resource_model_file = os.path.join( self.version_dirs, 'resources-1.json') self.example_model_file = os.path.join( self.version_dirs, 'examples-1.json') self.json_model = {} self.waiter_json_model = {} self.paginator_json_model = {} self.resource_json_model = {} self._setup_models() self.doc_name = 'MyDoc' self.doc_structure = DocumentStructure(self.doc_name) self.setup_client_and_resource()
def _create_docstring(self): docstring_structure = DocumentStructure('docstring') # Call the document method function with the args and kwargs # passed to the class. self._write_docstring(docstring_structure, *self._gen_args, **self._gen_kwargs) return docstring_structure.flush_structure().decode('utf-8')
def test_create_sections_at_instantiation(self): sections = ['intro', 'middle', 'end'] self.doc_structure = DocumentStructure( self.name, section_names=sections) # Ensure the sections are attached to the new document structure. for section_name in sections: section = self.doc_structure.get_section(section_name) self.assertEqual(section.name, section_name)
def setUp(self): self.original_name = 'original' self.alias_name = 'alias' self.parameter_alias = handlers.ParameterAlias( self.original_name, self.alias_name) self.operation_model = mock.Mock() request_shape = DenormalizedStructureBuilder().with_members( {self.original_name: {'type': 'string'}}).build_model() self.operation_model.input_shape = request_shape self.sample_section = DocumentStructure('') self.event_emitter = HierarchicalEmitter()
def document_service(self): """Documents an entire service. :returns: The reStructured text of the documented service. """ doc_structure = DocumentStructure(self._service_name, section_names=self.sections) self.title(doc_structure.get_section('title')) self.table_of_contents(doc_structure.get_section('table-of-contents')) self.client_api(doc_structure.get_section('client-api')) self.paginator_api(doc_structure.get_section('paginator-api')) self.waiter_api(doc_structure.get_section('waiter-api')) return doc_structure.flush_structure()
def document_service(self): """Documents an entire service. :returns: The reStructured text of the documented service. """ doc_structure = DocumentStructure(self._service_name, section_names=self.sections, target='html') self._document_title(doc_structure.get_section('title')) self._document_table_of_contents( doc_structure.get_section('table-of-contents')) self._document_client(doc_structure.get_section('client')) self._document_paginators(doc_structure.get_section('paginators')) self._document_waiters(doc_structure.get_section('waiters')) if self._service_resource: self._document_service_resource( doc_structure.get_section('service-resource')) self._document_resources(doc_structure.get_section('resources')) return doc_structure.flush_structure()
def setUp(self): self.root_dir = tempfile.mkdtemp() self.version_dirs = os.path.join( self.root_dir, 'myservice', '2014-01-01') os.makedirs(self.version_dirs) self.model_file = os.path.join(self.version_dirs, 'service-2.json') self.waiter_model_file = os.path.join( self.version_dirs, 'waiters-2.json') self.paginator_model_file = os.path.join( self.version_dirs, 'paginators-1.json') self.json_model = {} self.nested_json_model = {} self._setup_models() self.build_models() self.events = HierarchicalEmitter() self.setup_client() self.doc_name = 'MyDoc' self.doc_structure = DocumentStructure(self.doc_name)
def setUp(self): self.name = 'mydoc' self.doc_structure = DocumentStructure(self.name)