def __build_doxygen_doc(doxygen_configuration: dict, doxyfile: str) -> Optional[hostmydocs.Documentation]: """ Build the doxygen configuration using the doxyfile passed in arg :param doxygen_configuration: The dict which represent the updated doxygen config :param doxyfile: The path to the doxygen config updated :return: Documentations object ready to be uploaded. None if an error was occurred """ logging.info("Build Doxygen documentation") doxygen_config = AppConfiguration().get_doxygen_config() doxy_builder = doxygen.Generator( doxyfile, doxygen_path=doxygen_config[configurationEnum.Doxygen.DOXYGEN] if configurationEnum.Doxygen.DOXYGEN in doxygen_config else None ) zip_archive_path = doxy_builder.build(clean=True, generate_zip=True) logging.debug("Delete doxyfile: {}".format(doxyfile)) os.remove(doxyfile) if zip_archive_path is None: logging.error("Impossible to build documentation") return None return hostmydocs.Documentation( name=doxygen_configuration['PROJECT_NAME'], zip_archive_path=zip_archive_path, language=AppConfiguration().get_project_config()[configurationEnum.Project.LANG], version=doxygen_configuration['PROJECT_NUMBER'], )
def test_upload_documentation(self): doc = hostmydocs.Documentation(name="HostMyDocs-python-client", version="1.2.3.4", language="Python", zip_archive_path=self.doc_zip_archive) self.assertTrue(self.hmd_client.upload_documentation(doc))
def test_upload_documentation_not_existing_zip_archive(self): doc = hostmydocs.Documentation(name="HostMyDocs-python-client", version="1.2.3.4", language="Python", zip_archive_path="notExist.zip") self.assertFalse(self.hmd_client.upload_documentation(doc))
def test_get_all_documentations(self): doc = hostmydocs.Documentation(name="HostMyDocs-python-client", version="9.8.7.6", language="Python", zip_archive_path=self.doc_zip_archive) self.assertTrue(self.hmd_client.upload_documentation(doc)) list_of_documentations = self.hmd_client.get_all_documentations() self.assertIsNotNone(list_of_documentations) self.assertGreaterEqual(len(list_of_documentations), 1) doc_expected = hostmydocs.Documentation( name="HostMyDocs-python-client", version="9.8.7.6", language="Python") self.assertIn(doc_expected, list_of_documentations)
def test_upload_documentation_not_existing_server(self): server_config = hostmydocs.ServerConfig( address="someNotExistingBadServer.com", api_login="", api_password="") doc = hostmydocs.Documentation(name="HostMyDocs-python-client", version="1.2.3.4", language="Python", zip_archive_path=self.doc_zip_archive) client = hostmydocs.Client(server_config) self.assertFalse(client.upload_documentation(doc))