def test_Methodheap_MythXML_001_010(self): """Test MythXML.getRecorded() during standard time and daylight saving time. """ preview_cet_is_pic = False preview_cest_is_pic = False m_instance = MythXML() progs = m_instance.getRecorded() try: found_cet = False found_cest = False while True: p = next(progs) if not found_cet: if (p.starttime > self.t1_cet and p.starttime < self.t2_cet): pcet = p found_cet = True if not found_cest: if (p.starttime > self.t1_cest and p.starttime < self.t2_cest): pcest = p found_cest = True if (found_cet and found_cest): break except StopIteration: raise preview_cet = m_instance.getPreviewImage(str(pcet.chanid), pcet.recstartts) with open('/tmp/preview_cet', 'wb') as f: f.write(preview_cet) s_cet = System(path='file') out_cet = s_cet('/tmp/preview_cet') preview_cet_is_pic = ((b'PNG' in out_cet) or (b'JPEG' in out_cet)) preview_cest = m_instance.getPreviewImage(str(pcest.chanid), pcest.recstartts) with open('/tmp/preview_cest', 'wb') as f: f.write(preview_cest) s_cest = System(path='file') out_cest = s_cest('/tmp/preview_cest') preview_cest_is_pic = ((b'PNG' in out_cest) or (b'JPEG' in out_cest)) self.assertTrue(preview_cet_is_pic) self.assertTrue(preview_cest_is_pic)
def test_Methodheap_MythXML_002_010(self): """Test MythXML.getRecorded() during standard time and daylight saving time. """ preview_cet_is_pic = False preview_cest_is_pic = False with add_log_flags(): m_instance = MythXML() progs = m_instance.getRecorded() try: found_cet = False found_cest = False while True: p = next(progs) if not found_cet: if (p.starttime > self.t1_cet and p.starttime < self.t2_cet): pcet = p found_cet = True if not found_cest: if (p.starttime > self.t1_cest and p.starttime < self.t2_cest): pcest = p found_cest = True if (found_cet and found_cest): break except StopIteration: raise preview_cet = m_instance.getPreviewImage(str(pcet.chanid), pcet.recstartts) with open('/tmp/preview_cet', 'wb') as f: f.write(preview_cet) out_cet = System.system('file /tmp/preview_cet') preview_cet_is_pic = (len( tailandgrep('/tmp/my_logfile', 2, 'JPEG|PNG')) > 0) preview_cest = m_instance.getPreviewImage(str(pcest.chanid), pcest.recstartts) with open('/tmp/preview_cest', 'wb') as f: f.write(preview_cest) out_cest = System.system('file /tmp/preview_cest') preview_cest_is_pic = (len( tailandgrep('/tmp/my_logfile', 2, 'JPEG|PNG')) > 0) self.assertTrue(preview_cet_is_pic) self.assertTrue(preview_cest_is_pic)
def test_Methodheap_MythXML_001_09(self): """Test MythXML.getPreviewImage().""" m_instance = MythXML() rec_chanid = self.testenv['DOWNCHANID'] rec_starttime = self.testenv['DOWNSTARTTIME'] preview = m_instance.getPreviewImage(str(rec_chanid), rec_starttime) with open('/tmp/preview', 'wb') as f: f.write(preview) os.system('file /tmp/preview > /tmp/my_logfile') a = (len(tailandgrep('/tmp/my_logfile', 2, 'JPEG|PNG')) > 0) self.assertTrue(a)