コード例 #1
0
    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()
コード例 #2
0
    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()
コード例 #3
0
    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()
コード例 #4
0
    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()
コード例 #5
0
    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()
コード例 #6
0
    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()
コード例 #7
0
    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
コード例 #8
0
    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()