コード例 #1
0
 def test_Methodheap_MythXML_002_06(self):
     """Test MythXML.getChannelIcon() with logging."""
     a = False
     b = False
     with add_log_flags():
         m_instance = MythXML()
         icon = m_instance.getChannelIcon(self.testenv['RECCHANID'])
         with open('/tmp/icon', 'wb') as f:
             f.write(icon)
         os.system('file /tmp/icon >> /tmp/my_logfile')
         a = (len(tailandgrep('/tmp/my_logfile', 2, 'JPEG|PNG')) > 0)
         self.assertTrue(a)
         b = (len(tailandgrep('/tmp/my_logfile', 3, r'GetChannelIcon')) > 0)
     self.assertTrue(b)
コード例 #2
0
    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)
コード例 #3
0
 def test_Methodheap_MythXML_002_02(self):
     """Test MythXML.getKeys() with logging."""
     a = False
     with add_log_flags():
         m_instance = MythXML()
         keys_list = m_instance.getKeys()
         self.assertTrue(u'MenuTheme' in keys_list)
         a = (len(tailandgrep('/tmp/my_logfile', 3, r'/Myth/GetKeys')) > 0)
     self.assertTrue(a)
コード例 #4
0
 def test_Methodheap_MythXML_001_06(self):
     """Test MythXML.getChannelIcon()
     """
     m_instance = MythXML()
     icon = m_instance.getChannelIcon(self.testenv['RECCHANID'])
     with open('/tmp/icon', 'wb') as f:
         f.write(icon)
     os.system('file /tmp/icon > /tmp/my_logfile')
     a = (len(tailandgrep('/tmp/my_logfile', 2, 'JPEG|PNG')) > 0)
     self.assertTrue(a)
コード例 #5
0
 def test_Methodheap_Frontend_001_getScreenShot_01(self):
     """Test 'getScreenShot' methods from MythTV.Frontend().
     """
     screenshot = self.fe.getScreenShot()
     #print(type(screenshot))
     with open('/tmp/screenshot', 'wb') as f:
         f.write(screenshot)
     os.system('file /tmp/screenshot > /tmp/my_logfile')
     a = (len(tailandgrep('/tmp/my_logfile', 2, 'JPEG|PNG')) > 0)
     self.assertTrue(a)
コード例 #6
0
 def test_Methodheap_MythXML_002_03(self):
     """Test MythXML.getSetting() with logging."""
     a = False
     with add_log_flags():
         m_instance = MythXML()
         port = m_instance.getSetting('BackendServerPort', default='1111')
         self.assertTrue(int(port), 6543)
         a = (len(tailandgrep('/tmp/my_logfile', 3, r'BackendServerPort')) >
              0)
     self.assertTrue(a)
コード例 #7
0
 def test_MSearch_002_01(self):
     """Test MSearch.search() logging."""
     a = False
     b = False
     c = False
     with add_log_flags():
         m_instance = MSearch()
         g_generator = m_instance.search()
         u_dict = next(g_generator)
         self.assertTrue('location' in u_dict)
         self.assertIsNotNone(u_dict['location'])
         a = (len(
             tailandgrep('/tmp/my_logfile', 3,
                         r'Port 1900 opened for UPnP search')) > 0)
         b = (len(tailandgrep('/tmp/my_logfile', 4, r'running UPnP search'))
              > 0)
         c = (len(tailandgrep('/tmp/my_logfile', 6, u_dict['st'])) > 0)
     self.assertTrue(a)
     self.assertTrue(b)
     self.assertTrue(c)
コード例 #8
0
 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)
コード例 #9
0
 def test_Methodheap_MythXML_002_08(self):
     """Test MythXML.getExpiring() with logging."""
     a = False
     with add_log_flags():
         m_instance = MythXML()
         rec_list = m_instance.getExpiring()
         rec = next(rec_list)
         self.assertTrue(len(rec.title) > 0)
         a = (len(tailandgrep('/tmp/my_logfile', 3, r'GetExpiringList')) >
              0)
     self.assertTrue(a)
コード例 #10
0
 def test_MSearch_002_03(self):
     """Test MSearch.searchMythFE() logging."""
     a = False
     with add_log_flags():
         m_instance = MSearch()
         g_generator = m_instance.searchMythFE()
         u_dict = next(g_generator)
         self.assertTrue('location' in u_dict)
         self.assertIsNotNone(u_dict['location'])
         self.assertTrue('MediaRenderer' in u_dict['st'])
         a = (len(tailandgrep('/tmp/my_logfile', 1, u_dict['st'])) > 0)
     self.assertTrue(a)
コード例 #11
0
 def test_Methodheap_MythXML_002_04(self):
     """Test MythXML.getProgramGuide()  with logging."""
     a = False
     with add_log_flags():
         now_0 = pdtime.now()
         now_4 = now_0 + pddelta(hours=4)
         m_instance = MythXML()
         guide_list = m_instance.getProgramGuide(now_0.isoformat(),
                                                 now_4.isoformat(),
                                                 self.testenv['RECCHANID'],
                                                 numchan=None)
         prog = next(guide_list)
         self.assertTrue(len(prog.title) > 0)
         a = (len(tailandgrep('/tmp/my_logfile', 20, r'GetProgramGuide')) >
              0)
     self.assertTrue(a)
コード例 #12
0
    def test_test_Methodheap_MythSystemEvent_001_01(self):
        """Test if 'MythSystemEvent' calls a registered script for the
           system event 'KEY_01'.

        """
        mse = MythSystemEvent()

        time.sleep(1)

        # fire the system event 'KEY_01' from the backend
        cmd = "ssh mythtv@%s 'mythutil --systemevent KEY_01' >/dev/null" %(self.master_backend_ip)
        result = subprocess.call(cmd, shell=True)
        self.assertTrue(result == 0)

        time.sleep(1)

        s = tailandgrep("/tmp/my_mse_logfile", 3, "mythsystemeventtest.sh %s" %(self.master_hostname))
        self.assertTrue(len(s) > 0)
コード例 #13
0
    def test_test_Methodheap_BEEventMonitor_001_01(self):
        """Test 'BEEventMonitor' from MythTV.BEEventMonitor() with logging.
           Start the BEEventMonitor and watch the logs for events.
        """
        self.a = 0

        bemon = BEEventMonitor(systemevents=True)
        time.sleep(1)

        # start generating some log messages:
        # Jump to 'TV Recording Playback',
        loc = self.fe.sendQuery('location')
        if (loc != 'playbackbox'):
            self.fe.jump['playbackrecordings']
            time.sleep(1)

        # Select recordings
        k1 = self.fe.key['enter']
        self.assertTrue(k1)
        time.sleep(1)

        # Play program with chanid & starttime
        # play program CHANID yyyy-MM-ddThh:mm:ss
        k2 = self.fe.sendPlay('program %s' % self.p)
        self.assertTrue(k2)
        time.sleep(15)

        # stop playback of recording
        k3 = self.fe.key.escape
        self.assertTrue(k3)
        time.sleep(1)

        a = tailandgrep(
            '/tmp/my_logfile', 50,
            'BACKEND_MESSAGE\[\]:\[\]SYSTEM_EVENT PLAY_STOPPED HOSTNAME')

        self.assertTrue((len(a) > 0))