Files
o3de/AutomatedTesting/Gem/PythonTests/prefab/Prefab_BasicWorkflow_CreateAndDeletePrefab.py
T
chiyenteng 23322edde7 Fix Entity id consistency issue & refactor prefab workflows/tests (#4373)
* Fix Entity id consistency issue & refactor prefab workflows/test framework

Signed-off-by: chiyteng <chiyteng@amazon.com>

* Update comments

Signed-off-by: chiyteng <chiyteng@amazon.com>

* Modify CreatePrefab and remove extra spaces

Signed-off-by: chiyteng <chiyteng@amazon.com>

* Address comments

Signed-off-by: chiyteng <chiyteng@amazon.com>

* Refactor prefab instance constructors

Signed-off-by: chiyteng <chiyteng@amazon.com>

* Remove commented out code

Signed-off-by: chiyteng <chiyteng@amazon.com>
2021-10-01 10:02:00 -07:00

34 lines
1.0 KiB
Python

"""
Copyright (c) Contributors to the Open 3D Engine Project.
For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
def Prefab_BasicWorkflow_CreateAndDeletePrefab():
CAR_PREFAB_FILE_NAME = 'car_prefab'
from editor_python_test_tools.editor_entity_utils import EditorEntity
from prefab.Prefab import Prefab
import prefab.Prefab_Test_Utils as prefab_test_utils
prefab_test_utils.open_base_tests_level()
# Creates a new Entity at the root level
# Asserts if creation didn't succeed
car_entity = EditorEntity.create_editor_entity()
car_prefab_entities = [car_entity]
# Checks for prefab creation passed or not
_, car = Prefab.create_prefab(
car_prefab_entities, CAR_PREFAB_FILE_NAME)
# Checks for prefab deletion passed or not
Prefab.remove_prefabs([car])
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(Prefab_BasicWorkflow_CreateAndDeletePrefab)