def get(self, asset_id): """ Resource to retrieve the casting of a given asset. """ asset = assets_service.get_asset(asset_id) user_service.check_project_access(asset["project_id"]) return breakdown_service.get_cast_in(asset_id)
def test_update_casting(self): self.shot_id = str(self.shot.id) self.asset_id = str(self.asset.id) self.asset_character_id = str(self.asset_character.id) casting = breakdown_service.get_casting(self.shot.id) self.assertListEqual(casting, []) new_casting = [{ "asset_id": self.asset_id, "nb_occurences": 1 }, { "asset_id": self.asset_character_id, "nb_occurences": 3 }] breakdown_service.update_casting(self.shot.id, new_casting) casting = breakdown_service.get_casting(self.shot.id) casting = sorted(casting, key=lambda x: x["nb_occurences"]) self.assertEquals(casting[0]["asset_id"], new_casting[0]["asset_id"]) self.assertEquals(casting[0]["nb_occurences"], new_casting[0]["nb_occurences"]) self.assertEquals(casting[1]["asset_id"], new_casting[1]["asset_id"]) self.assertEquals(casting[1]["nb_occurences"], new_casting[1]["nb_occurences"]) self.assertEquals(casting[1]["asset_name"], self.asset_character.name) self.assertEquals(casting[1]["asset_type_name"], self.asset_type_character.name) cast_in = breakdown_service.get_cast_in(self.asset_character.id) self.assertEquals(cast_in[0]["shot_name"], self.shot.name) self.assertEquals(cast_in[0]["sequence_name"], self.sequence.name) self.assertEquals(cast_in[0]["episode_name"], self.episode.name)
def get(self, asset_id): """ Resource to retrieve the casting of a given asset. """ asset = assets_service.get_asset(asset_id) if not permissions.has_manager_permissions(): user_service.check_has_task_related(asset["project_id"]) return breakdown_service.get_cast_in(asset_id)
def get(self, asset_id): """ Resource to retrieve the casting of a given asset. --- tags: - Assets parameters: - in: path name: asset_id required: True schema: type: UUID example: a24a6ea4-ce75-4665-a070-57453082c25 responses: 200: description: Casting of given asset """ asset = assets_service.get_asset(asset_id) user_service.check_project_access(asset["project_id"]) user_service.check_entity_access(asset["id"]) return breakdown_service.get_cast_in(asset_id)