def test_invalid_name(self, ConnectionMock): v = Video(name="Name is too long" * 20, short_description="ok desc", filename="somefile.mov") try: v.validate() except pybrightcove.exceptions.PyBrightcoveError, e: self.assertEqual(str(e), "Video.name must be 255 characters or less.")
def test_invalid_video_full_length(self, ConnectionMock): video = Video(name="Name is too long", short_description="ok desc", filename="somefile.mov") video.video_full_length = 10 try: video.validate() except pybrightcove.exceptions.PyBrightcoveError, e: self.assertEqual(str(e), "Video.video_full_length must be of type Rendition")
def test_invalid_reference_id(self, ConnectionMock): video = Video(name="Name is too long", short_description="ok desc", filename="somefile.mov") video.reference_id = "long ref id" * 100 try: video.validate() except pybrightcove.exceptions.PyBrightcoveError, e: self.assertEqual(str(e), "Video.reference_id must be 150 characters or less.")
def test_invalid_long_description(self, ConnectionMock): video = Video(name="Name is too long", short_description="ok desc", filename="somefile.mov") video.long_description = "Very long" * 5000 try: video.validate() except pybrightcove.exceptions.PyBrightcoveError, e: self.assertEqual(str(e), "Video.long_description must be 5000 characters or less.")
def test_invalid_item_state(self, ConnectionMock): video = Video(name="Name is too long", short_description="ok desc", filename="somefile.mov") video.item_state = "Invalid" try: video.validate() except pybrightcove.exceptions.PyBrightcoveError, e: err = "Video.item_state must be either ItemStateEnum.ACTIVE or " err += "ItemStateEnum.INACTIVE or ItemStateEnum.DELETED" self.assertEqual(str(e), err)
def test_invalid_economics(self, ConnectionMock): video = Video(name="Name is too long", short_description="ok desc", filename="somefile.mov") video.economics = "The Keynesian view is Wrong" try: video.validate() except pybrightcove.exceptions.PyBrightcoveError, e: err = "Video.economics must be either EconomicsEnum.FREE or" err += " EconomicsEnum.AD_SUPPORTED" self.assertEqual(str(e), err)