def test_add_instance_to_shot(self): instances = breakdown_service.get_asset_instances_for_shot( self.shot.id) self.assertEquals(instances, {}) asset_instance = self.new_scene_instance(self.asset_id) self.new_shot_instance(asset_instance["id"]) asset_instance = self.new_scene_instance(self.asset_id) self.new_shot_instance(asset_instance["id"]) asset_instance = self.new_scene_instance(self.asset_character_id) self.new_shot_instance(asset_instance["id"]) instances = breakdown_service.get_asset_instances_for_shot( self.shot.id) self.assertEquals(len(instances[self.asset_id]), 2) self.assertEquals(len(instances[self.asset_character_id]), 1) self.assertEquals(instances[self.asset_id][0]["number"], 1) self.assertEquals(instances[self.asset_id][1]["number"], 2) self.assertEquals(instances[self.asset_id][1]["name"], "tree_0002") self.assertEquals(instances[self.asset_character_id][0]["number"], 1) instances = breakdown_service.remove_asset_instance_for_shot( self.shot.id, asset_instance["id"]) instances = breakdown_service.get_asset_instances_for_shot( self.shot.id) self.assertTrue(self.asset_character_id not in instances)
def get(self, shot_id): """ Retrieve all asset instances linked to shot. """ shot = shots_service.get_shot(shot_id) user_service.check_project_access(shot["project_id"]) return breakdown_service.get_asset_instances_for_shot(shot_id)
def test_add_instance_to_shot(self): instances = breakdown_service.get_asset_instances_for_shot( self.shot.id) self.assertEquals(instances, {}) self.new_shot_instance(self.entity_id) self.new_shot_instance(self.entity_id) self.new_shot_instance(self.entity_character_id) instances = breakdown_service.get_asset_instances_for_shot( self.shot.id) self.assertEquals(len(instances[self.entity_id]), 2) self.assertEquals(len(instances[self.entity_character_id]), 1) self.assertEquals(instances[self.entity_id][0]["number"], 1) self.assertEquals(instances[self.entity_id][1]["number"], 2) self.assertEquals(instances[self.entity_character_id][0]["number"], 1)