def test_update_delete_streaming_profile(self): name = self.test_id + "_streaming_profile_delete" api.create_streaming_profile( name, representations=[{"transformation": { "bit_rate": "5m", "height": 1200, "width": 1200, "crop": "limit" }}]) result = api.update_streaming_profile( name, representations=[{"transformation": { "bit_rate": "5m", "height": 1000, "width": 1000, "crop": "scale" }}]) self.assertIn("representations", result["data"]) reps = result["data"]["representations"] self.assertIsInstance(reps, list) # transformation is returned as an array self.assertIsInstance(reps[0]["transformation"], list) tr = reps[0]["transformation"][0] expected = {"bit_rate": "5m", "height": 1000, "width": 1000, "crop": "scale"} self.assertDictEqual(expected, tr) api.delete_streaming_profile(name) result = api.list_streaming_profiles() self.assertNotIn(name, [p["name"] for p in result["data"]])
def test_list_streaming_profiles(self): """should list streaming profile""" result = api.list_streaming_profiles() names = [sp["name"] for sp in result["data"]] self.assertTrue(len(names) >= len(self.__predefined_sp)) """streaming profiles should include the predefined profiles""" for name in self.__predefined_sp: self.assertIn(name, names)
def test_update_delete_streaming_profile(self): name = StreamingProfilesTest.test_id + "_streaming_profile_delete" api.create_streaming_profile(name, representations=[{ "transformation": { "bit_rate": "5m", "height": 1200, "width": 1200, "crop": "limit" } }]) result = api.update_streaming_profile(name, representations=[{ "transformation": { "bit_rate": "5m", "height": 1000, "width": 1000, "crop": "scale" } }]) self.assertIn("representations", result["data"]) reps = result["data"]["representations"] self.assertIsInstance(reps, list) """transformation is returned as an array""" self.assertIsInstance(reps[0]["transformation"], list) tr = reps[0]["transformation"][0] expected = { "bit_rate": "5m", "height": 1000, "width": 1000, "crop": "scale" } self.assertDictEqual(expected, tr) api.delete_streaming_profile(name) result = api.list_streaming_profiles() self.assertNotIn(name, [p["name"] for p in result["data"]])