示例#1
0
    def test_submit_job_to_ptburn_with_audio(self, label_patch, required_files,
                                             glob_patch):

        required_files.return_value = True
        label = Mock(sermon_title="title", date=datetime.date(2014,1,1),
           day="SUN, AM", minister="H.L. Sheppard")
        label.get_label_key.return_value = "010114PM"
        glob_patch.return_value = ["one.mp3", "two.mp3"]
        
        new_job = Job(1, self.connection)
        new_job.printonly = False
        new_job.label = label
        new_job.submit_job_to_ptburn("/audio/", "/labels/","/tmp/")

        self.assertTrue(os.path.exists("/tmp/JOB_1.jrq"))
        job_file = open("/tmp/JOB_1.jrq").readlines()
        self.assertEquals(len(job_file), 11)
        self.assertTrue("JobID = 1\n" in job_file)
        self.assertTrue("VolumeName = 010114PM\n" in job_file)
        self.assertTrue("AudioFile = one.mp3\n" in job_file)
        self.assertTrue("AudioFile = two.mp3\n" in job_file)
        self.assertTrue("CloseDisc = YES\n" in job_file)
        self.assertTrue("Copies = 1\n" in job_file)
        self.assertTrue("PrintLabel = /labels/cd-label.std\n" in job_file)
        self.assertTrue("MergeField = title\n" in job_file)
        self.assertTrue("MergeField = 01/01/2014\n" in job_file)
        self.assertTrue("MergeField = SUN, AM\n" in job_file)
        self.assertTrue("MergeField = H.L. Sheppard\n" in job_file)
示例#2
0
    def test_submit_job_to_ptburn_print_only(self, label_patch, required_files):

        required_files.return_value = False
        label = Mock(sermon_title="title", date=datetime.date(2014,1,1),
           day="SUN, AM", minister="H.L. Sheppard")
        
        new_job = Job(1, self.connection)
        new_job.printonly = True
        new_job.label = label
        new_job.submit_job_to_ptburn("/audio/", "/labels/","/tmp/")

        self.assertTrue(os.path.exists("/tmp/JOB_1.jrq"))
        job_file = open("/tmp/JOB_1.jrq").readlines()
        self.assertEquals(len(job_file), 7)
        self.assertTrue("JobID = 1\n" in job_file)
        self.assertTrue("Copies = 1\n" in job_file)
        self.assertTrue("PrintLabel = /labels/cd-label.std\n" in job_file)
        self.assertTrue("MergeField = title\n" in job_file)
        self.assertTrue("MergeField = 01/01/2014\n" in job_file)
        self.assertTrue("MergeField = SUN, AM\n" in job_file)
        self.assertTrue("MergeField = H.L. Sheppard\n" in job_file)