Files
o3de/scripts/o3de/tests/test_utils.py
T
lumberyard-employee-dm 62775add6d Implemented Support to allow project's to reference gems via the gem name (#7109)
* Implemented Support to allow project's to reference gems via the gem name

Updated the enable-gem command to add the name of the enabled gem to the "gem_names" array in the project.json
Updated the enable-gem test to validate this functionality

Centralized the CMake logic for locating external subdirectories to the Subdirectories.cmake script

Added an option to the edit-project-properties and edit-engine-properties o3de.py commands to add/remove/replace the "gem_names" field in the project.json and engine.json respectively

Added a CMake function to determine the root CMake "subdirectory" of any input path which is a parent of it.
This logic has been used to improve the installation of external gems to the <install-root>/External directory.

Tested out the install layout before submitting PR

fixes #7108

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Fixed the enable-gem test on Linux to resolve the mock path.

Renamed all of the o3de python test from "unit_test*.py" to "test*.py" to faciliate the python unittest module picking up the test automatically.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Adding test for the disable_gem command.

Fixed some typos in engine_properties.py scrip.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
2022-01-26 10:44:35 -06:00

40 lines
1.2 KiB
Python
Executable File

#
# 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
#
#
import pytest
from o3de import utils
@pytest.mark.parametrize(
"value, expected_result", [
pytest.param('Game1', True),
pytest.param('0Game1', False),
pytest.param('the/Game1', False),
pytest.param('', False),
pytest.param('-test', False),
pytest.param('test-', True),
]
)
def test_validate_identifier(value, expected_result):
result = utils.validate_identifier(value)
assert result == expected_result
@pytest.mark.parametrize(
"value, expected_result", [
pytest.param('{018427ae-cd08-4ff1-ad3b-9b95256c17ca}', False),
pytest.param('', False),
pytest.param('{018427aecd084ff1ad3b9b95256c17ca}', False),
pytest.param('018427ae-cd08-4ff1-ad3b-9b95256c17ca', True),
pytest.param('018427aecd084ff1ad3b9b95256c17ca', False),
pytest.param('018427aecd084ff1ad3b9', False),
]
)
def test_validate_uuid4(value, expected_result):
result = utils.validate_uuid4(value)
assert result == expected_result