Пример #1
0
    def test_run_check_tasks_except_check(self, m_log):
        m_run = FirstTimeRun()

        check_task = FirstTimeRun.CheckTask(True, self.fake_task)
        m_run._check_tasks.append(check_task)

        m_run._run_check_tasks()

        m_log.error.assert_called_once()
Пример #2
0
    def test_run_check_tasks(self):
        # Crate a mocked method
        m_method = mock.Mock()
        m_run = FirstTimeRun()

        # create CheckTask instance
        check_task = FirstTimeRun.CheckTask(self.fake_check_true, m_method)
        m_run._check_tasks.append(check_task)

        m_run._run_check_tasks()

        m_method.assert_called_once()
Пример #3
0
    def test_run_check_tasks_except_task(self, m_log):
        # Crate a mocked method
        m_method = mock.Mock()
        m_method.side_effect = Exception("Whoops")
        m_run = FirstTimeRun()

        check_task = FirstTimeRun.CheckTask(self.fake_check_true, m_method)
        # Force mocked method into the tasks list
        m_run._check_tasks.append(check_task)

        m_run._run_check_tasks()

        m_method.assert_called_once()
        m_log.error.assert_called_once()