def FileLoggerLogFolderMessagingLevel(self): log_folder_messaging_level_directory_path = LoggingConfig.getLogDirectory( ) + "/" + "Log Folder Messaging Level Directory" logger = HtmlFileLogger(log_folder_messaging_level_directory_path, MessageType.WARNING) softAssert = SoftAssert() softAssert.assertEquals( log_folder_messaging_level_directory_path, logger.getDirectory(), "Expected Directory 'Log Folder Messaging Level Directory'.") softAssert.assertEquals("FileLog.html", logger.getFileName(), "Expected correct File Name.") softAssert.assertEquals(MessageType.WARNING, logger.getMessageType(), "Expected Warning Message Type.") softAssert.assertAll()
def FileLoggerAppendLogFolder(self): append_file_directory_path = LoggingConfig.getLogDirectory( ) + "/" + "Append File Directory" logger = HtmlFileLogger(append_file_directory_path, True) softAssert = SoftAssert() softAssert.assertEquals(append_file_directory_path, logger.getDirectory(), "Expected Directory 'Append File Directory'.") softAssert.assertEquals("FileLog.html", logger.getFileName(), "Expected correct File Name.") softAssert.assertEquals(MessageType.INFORMATION, logger.getMessageType(), "Expected Information Message Type.") softAssert.assertAll()
def FileLoggerLogFolderFileName(self): log_folder_file_name_directory = LoggingConfig.getLogDirectory( ) + "/" + "Log Folder File Name Directory" logger = HtmlFileLogger(log_folder_file_name_directory, "LogFolderFileName.html") softAssert = SoftAssert() softAssert.assertEquals( log_folder_file_name_directory, logger.getDirectory(), "Expected Directory 'Log Folder File Name Directory'.") softAssert.assertEquals("LogFolderFileName.html", logger.getFileName(), "Expected correct File Name.") softAssert.assertEquals(MessageType.INFORMATION, logger.getMessageType(), "Expected Information Message Type.") softAssert.assertAll()
def FileLoggerMessagingLevelFileName(self): logger = HtmlFileLogger(MessageType.WARNING, "MessagingTypeFile.html") softAssert = SoftAssert() softAssert.assertEquals( System.getProperty("java.io.tmpdir"), logger.getDirectory(), StringProcessor.safeFormatter( "Expected Directory '%s'.", System.getProperty("java.io.tmpdir"))) softAssert.assertEquals("MessagingTypeFile.html", logger.getFileName(), "Expected correct File Name.") softAssert.assertEquals(MessageType.WARNING, logger.getMessageType(), "Expected Warning Message Type.") softAssert.assertAll() file = logger.getFilePath() file.delete()
def FileLoggerAppendLogFolderMessagingLevel(self): appendLogFolderFileNameDirectory = LoggingConfig.getLogDirectory( ) + "/" + "AppendLogFolderFileNameDirectory" logger = HtmlFileLogger(True, appendLogFolderFileNameDirectory, MessageType.WARNING) softAssert = SoftAssert() softAssert.assertEquals( appendLogFolderFileNameDirectory, logger.getDirectory(), " Expected Directory AppendLogFolderFileNameDirectory") softAssert.assertEquals("FileLog.html", logger.getFileName(), "Expected correct File Name.") softAssert.assertEquals(MessageType.WARNING, logger.getMessageType(), "Expected Warning Message Type.") softAssert.assertAll() file = logger.getFilePath() file.delete()
def FileLoggerAppendFileName(self): logger = HtmlFileLogger(True, "AppendFileName") softAssert = SoftAssert() softAssert.assertEquals( System.getProperty("java.io.tmpdir"), logger.getDirectory(), StringProcessor.safeFormatter( "Expected Directory '%s'.", System.getProperty("java.io.tmpdir"))) softAssert.assertEquals("AppendFileName.html", logger.getFileName(), "Expected correct File Name.") softAssert.assertEquals(MessageType.INFORMATION, logger.getMessageType(), "Expected Information Message Type.") softAssert.assertAll() file = logger.getFilePath() file.delete()
def HtmlFileLoggerConstructorCreateDirectory(self): logger = HtmlFileLogger( True, LoggingConfig.getLogDirectory(), "HtmlFileLoggerCreateDirectoryDelete").toString( ), "HtmlFileLoggerCreateDirectory", MessageType.GENERIC logger.logMessage( MessageType.WARNING, "Test to ensure that the file in the created directory can be written to." ) file = logger.getFilePath() self.assertTrue( self.readTextFile(logger.getFilePath()).contains( "Test to ensure that the file in the created directory can be written to." )) file.delete() file = logger.getDirectory() try: os.rename(file) except OSError as e: e.with_traceback
def FileLoggerLogFolderFileNameMessagingLevel(self): logFolderFileNameMessagingLevelDirectoryPath = LoggingConfig.getLogDirectory( ) + "/" + "LogFolderFileNameMessagingLevelDirectory" logger = HtmlFileLogger(logFolderFileNameMessagingLevelDirectoryPath, "LogFolderFileNameMessagingLevel.html", MessageType.WARNING) softAssert = SoftAssert() softAssert.assert_equals( logFolderFileNameMessagingLevelDirectoryPath, logger.getDirectory(), "Expected Directory 'LogFolderFileNameMessagingLevelDirectory'") softAssert.assert_equals("LogFolderFileNameMessagingLevel.html", logger.getFileName(), "Expected correct File Name.") softAssert.assert_equals(MessageType.WARNING, logger.getMessageType(), "Expected Warning Message Type.") softAssert.assert_all() file = logger.getFilePath() file.delete()