def test_item_states(self, ConnectionMock): api = self._get_list_mock(ConnectionMock) video = Video(name="Name of video", id=TEST_VIDEO_ID) video.item_state = enums.ItemStateEnum.PENDING, video.save() item_state_sent = api.method_calls[1][2]['video']['itemState'][0] self.assertEquals(item_state_sent, enums.ItemStateEnum.PENDING)
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)