Example #1
0
 def addHTMLLog(self, name, html):
     assert self.started # addLog before stepStarted won't notify watchers
     logfilename = self.build.generateLogfileName(self.name, name)
     log = HTMLLogFile(self, name, logfilename, html)
     self.logs.append(log)
     for w in self.watchers:
         w.logStarted(self.build, self, log)
         w.logFinished(self.build, self, log)
    def setupStatus(self,
                    name=None,
                    text=None,
                    has_content=False,
                    content_type=None,
                    html_log=True):
        st = self.build_step_status = mock.Mock(BuildStepStatus)
        self.logs = []
        st.getLogs = lambda: self.logs

        if name is None:
            return st

        step = self.setupBuildStepStatus()
        log = HTMLLogFile(step, "example", "test file", "test html") if html_log \
            else LogFile(step, "example", "test file")
        log.getName = lambda: name
        log.hasContents = lambda: has_content
        log.content_type = content_type
        log.getText = lambda: text
        self.logs.append(log)

        return st
    def test_log_initialize_attribute(self):
        step = self.setupBuildStepStatus()
        htmllog = HTMLLogFile(step, "example", "test file", "test html")

        self.assertEquals(htmllog.content_type, "")