def test_Dataheap_Job_002_01(self):
        """Test classmethod Job.fromProgram() from 'dataheap'.
        This test triggers a job to rebuild the the seek table of program.
        Note: I did not realized that this is possible, it is not mentioned
        in the wiki:
        You have to grep the source code for the flag 'JOB_REBUILD'.
        Additional note: The log does not say anything about rebuilding the seektable.
        """
        chanid        = self.testenv['DOWNCHANID']
        starttimemyth = self.testenv['DOWNSTARTTIME']

        hostname = self.mydb.getMasterBackend()
        rec = Recorded((chanid, starttimemyth), db = self.mydb)
        prgrm = rec.getProgram()
        self.assertEqual(RECSTATUS.rsRecorded, prgrm.recstatus)

        myjob = Job.fromProgram(prgrm, JOBTYPE.COMMFLAG, hostname=hostname,
                                flags=JOBFLAG.REBUILD)

        loopnr = 0
        while (myjob.status < JOBSTATUS.FINISHED):
            time.sleep(10)
            myjob._pull()     # this re-reads the jobqueue table
            loopnr += 1
            if (loopnr > 60):
                break

        self.assertEqual(myjob.status, JOBSTATUS.FINISHED)

        # test '__repr__' and '__str__'
        print()
        print(repr(myjob))
        print(str(myjob))
    def test_Dataheap_Job_002_02(self):
        """Test exception of classmethod Job.fromProgram() from 'dataheap'.
        """
        chanid        = self.testenv['DOWNCHANID']
        starttimemyth = self.testenv['DOWNSTARTTIME']

        hostname = self.mydb.getMasterBackend()
        rec = Recorded((chanid, starttimemyth), db = self.mydb)
        prgrm = rec.getProgram()
        self.assertEqual(RECSTATUS.rsRecorded, prgrm.recstatus)

        # set recstatus to 'rsUnknown' and capture the error:
        prgrm.recstatus = RECSTATUS.rsUnknown
        with self.assertRaises(MythError):
            myjob = Job.fromProgram(prgrm, JOBTYPE.COMMFLAG,
                                    hostname=hostname, flags=JOBFLAG.REBUILD)