class test_Methodheap_MythDB_005(unittest.TestCase):
    """Test method 'searchGuide' from MythTV.MythDB()."""

    @classmethod
    def setUpClass(cls):
        # get the global test environment
        global TestEnv
        cls.testenv = TestEnv

    def setUp(self):
        self.mydb = MythDB()


    def test_Methodheap_MythDB_005_searchGuide_01(self):
        """Test 'searchGuide' method from MythTV.MythDB().
        """

        guide =  next(self.mydb.searchGuide())
        self.assertTrue(isinstance(guide, Guide))

        # test '__repr__' and '__str__'
        print()
        print(repr(guide))
        # print(str(guide))   # XXX this does not work


    def test_Methodheap_MythDB_005_searchGuide_02(self):
        """Test 'searchGuide' method from MythTV.MythDB() using fuzzy title.
        """

        guide_fuzz =  next(self.mydb.searchGuide( fuzzytitle = \
                                            self.testenv['UPTITLEFUZZY']) )
        self.assertTrue(isinstance(guide_fuzz, Guide))
        # check if accessing a property works
        self.assertTrue(self.testenv['UPTITLEFUZZY'] in guide_fuzz.title)
Exemple #2
0
from MythTV import MythDB, Record

my_myth_db = MythDB(args=(('DBHostName', 'localhost'),
                                  ('DBName', 'mythconverg'),
                                  ('DBUserName', 'root'),
                                  ('DBPassword', ''),
                                  ('DBPort', '3306')))

shows = my_myth_db.searchGuide(category="Special")
for x in shows:
  x.record(Record.kFindOneRecord)