Esempio n. 1
0
    def test_get(self):
        """Provided the show id, you should be able to get the show object"""
        api = TVDB("B43FF87DE395DF56")
        show = api.get(79349, "en")

        self.assertEqual(show.SeriesName, "Dexter")
        self.assertEqual(show.id, 79349)
Esempio n. 2
0
    def test_get_actors(self):
        """
        The Show instance should have an actor_objects attribute when the
        actor data is loaded.
        """
        api = TVDB("B43FF87DE395DF56", actors=True)
        show = api.get(79349, "en")  # Load the series Dexter
        show.update()

        self.assertEqual(hasattr(show, "actor_objects"), True)
Esempio n. 3
0
    def test_no_actors(self):
        """
        The Show instance should have an empty actor_objects when the
        actor data has not been loaded.
        """
        api = TVDB("B43FF87DE395DF56", actors=False)
        show = api.get(79349, "en")  # Load the series Dexter
        show.update()

        self.assertEqual(len(show.actor_objects), 0)
Esempio n. 4
0
    def test_iterable_actors(self):
        """
        It should be possible to iterate over the actor objects
        """
        api = TVDB("B43FF87DE395DF56", actors=True)
        show = api.get(79349, "en")  # Load the series Dexter
        show.update()

        for actor in show.actor_objects:
            self.assertEqual(type(actor), Actor)
Esempio n. 5
0
    def test_iterable_actors(self):
        """
        It should be possible to iterate over the actor objects
        """
        api = TVDB("B43FF87DE395DF56", actors=True)
        show = api.get(79349, "en")  # Load the series Dexter
        show.update()

        for actor in show.actor_objects:
            self.assertEqual(type(actor), Actor)
Esempio n. 6
0
    def test_get_actors(self):
        """
        The Show instance should have an actor_objects attribute when the
        actor data is loaded.
        """
        api = TVDB("B43FF87DE395DF56", actors=True)
        show = api.get(79349, "en")  # Load the series Dexter
        show.update()

        self.assertEqual(hasattr(show, "actor_objects"), True)
Esempio n. 7
0
    def test_no_actors(self):
        """
        The Show instance should have an empty actor_objects when the
        actor data has not been loaded.
        """
        api = TVDB("B43FF87DE395DF56", actors=False)
        show = api.get(79349, "en")  # Load the series Dexter
        show.update()

        self.assertEqual(len(show.actor_objects), 0)
Esempio n. 8
0
    def test_invalid_actor_attribute(self):
        """
        Actor instance should raise an exception when accessing an invalid
        attribute.
        """
        api = TVDB("B43FF87DE395DF56", actors=True)
        show = api.get(79349, "en")  # Load the series Dexter
        show.update()

        actor = show.actor_objects[0]
        self.assertRaises(error.TVDBAttributeError, actor.__getattr__, 'foo')
Esempio n. 9
0
    def test_invalid_actor_attribute(self):
        """
        Actor instance should raise an exception when accessing an invalid
        attribute.
        """
        api = TVDB("B43FF87DE395DF56", actors=True)
        show = api.get(79349, "en")  # Load the series Dexter
        show.update()

        actor = show.actor_objects[0]
        self.assertRaises(error.TVDBAttributeError, actor.__getattr__, 'foo')
Esempio n. 10
0
    def test_actor_representation(self):
        """
        The representation of the actor should be properly formatted.
        """
        api = TVDB("B43FF87DE395DF56", actors=True)
        show = api.get(79349, "en")  # Load the series Dexter
        show.update()

        regexp = re.compile("^<Actor - .*?>$")

        for actor in show.actor_objects:
            self.assertNotEqual(regexp.match(actor.__repr__()), None)
Esempio n. 11
0
    def test_actor_representation(self):
        """
        The representation of the actor should be properly formatted.
        """
        api = TVDB("B43FF87DE395DF56", actors=True)
        show = api.get(79349, "en")  # Load the series Dexter
        show.update()

        regexp = re.compile("^<Actor - .*?>$")

        for actor in show.actor_objects:
            self.assertNotEqual(regexp.match(actor.__repr__()), None)
Esempio n. 12
0
    def test_insensitive_attributes(self):
        """If selected, it should be possible to access the attributes in a case insensitive manner."""

        api = TVDB("B43FF87DE395DF56", banners=True, ignore_case=True)
        show = api.get(79349, "en")  # Load the series Dexter
        show.update()

        banner = show.banner_objects[0]
        for a in dir(banner):
            self.assertTrue(hasattr(banner, a))
            self.assertTrue(hasattr(banner, a.lower()))
            self.assertTrue(hasattr(banner, a.upper()))
Esempio n. 13
0
    def test_insensitive_attributes(self):
        """If selected, it should be possible to access the attributes in a case insensitive manner"""

        api = TVDB("B43FF87DE395DF56", actors=True, ignore_case=True)
        show = api.get(79349, "en")  # Load the series Dexter
        show.update()

        actor = show.actor_objects[0]
        for a in dir(actor):
            self.assertTrue(hasattr(actor, a))
            self.assertTrue(hasattr(actor, a.lower()))
            self.assertTrue(hasattr(actor, a.upper()))
Esempio n. 14
0
    def test_actor_attributes(self):
        """
        The attributes of the Actors class should be correct
        """
        api = TVDB("B43FF87DE395DF56", actors=True)
        show = api.get(79349, "en")  # Load the series Dexter
        show.update()

        actor = show.actor_objects[0]

        self.assertEqual(hasattr(actor, "id"), True)
        self.assertEqual(hasattr(actor, "Image"), True)
        self.assertEqual(hasattr(actor, "Name"), True)
        self.assertEqual(hasattr(actor, "Role"), True)
        self.assertEqual(hasattr(actor, "SortOrder"), True)
        self.assertEqual(hasattr(actor, "image_url"), True)

        self.assertEqual(len(dir(actor)), 6)
Esempio n. 15
0
    def test_actor_attributes(self):
        """
        The attributes of the Actors class should be correct
        """
        api = TVDB("B43FF87DE395DF56", actors=True)
        show = api.get(79349, "en")  # Load the series Dexter
        show.update()

        actor = show.actor_objects[0]

        self.assertEqual(hasattr(actor, "id"), True)
        self.assertEqual(hasattr(actor, "Image"), True)
        self.assertEqual(hasattr(actor, "Name"), True)
        self.assertEqual(hasattr(actor, "Role"), True)
        self.assertEqual(hasattr(actor, "SortOrder"), True)
        self.assertEqual(hasattr(actor, "image_url"), True)

        self.assertEqual(len(dir(actor)), 6)
Esempio n. 16
0
 def setUp(self):
     api = TVDB("B43FF87DE395DF56", actors=True)
     self.show = api.get(79349, "en")  # Load the series Dexter
     self.show.update()
Esempio n. 17
0
    def _getShow(self, _banners=True):
        api = TVDB("B43FF87DE395DF56", banners=_banners)
        show = api.get(79349, "en")  # Load the series Dexter
        show.update()

        return show
Esempio n. 18
0
    def _getShow(self, _banners=True):
        api = TVDB("B43FF87DE395DF56", banners=_banners)
        show = api.get(79349, "en")  # Load the series Dexter
        show.update()

        return show
Esempio n. 19
0
 def setUp(self):
     api = TVDB("B43FF87DE395DF56", actors=True)
     self.show = api.get(79349, "en")  # Load the series Dexter
     self.show.update()