|
|
|
|
@ -14,6 +14,7 @@ Unit tests for ly_test_tools._internal.managers.platforms.windows
|
|
|
|
|
import unittest.mock as mock
|
|
|
|
|
import os
|
|
|
|
|
import pytest
|
|
|
|
|
import ly_test_tools
|
|
|
|
|
|
|
|
|
|
from ly_test_tools._internal.managers.platforms.windows import (
|
|
|
|
|
_WindowsResourceLocator, WindowsWorkspaceManager,
|
|
|
|
|
@ -34,22 +35,16 @@ mock_project = 'mock_project'
|
|
|
|
|
mock_tmp_path = 'mock_tmp_path'
|
|
|
|
|
mock_output_path = 'mock_output_path'
|
|
|
|
|
|
|
|
|
|
windows_resource_locator = _WindowsResourceLocator(
|
|
|
|
|
build_directory=mock_build_directory,
|
|
|
|
|
project=mock_project)
|
|
|
|
|
|
|
|
|
|
windows_workspace_manager = WindowsWorkspaceManager(
|
|
|
|
|
build_directory=mock_build_directory,
|
|
|
|
|
project=mock_project,
|
|
|
|
|
tmp_path=mock_tmp_path,
|
|
|
|
|
output_path=mock_output_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@mock.patch('ly_test_tools._internal.managers.abstract_resource_locator._find_engine_root',
|
|
|
|
|
mock.MagicMock(return_value=(mock_engine_root, mock_dev_path)))
|
|
|
|
|
mock.MagicMock(return_value=mock_engine_root))
|
|
|
|
|
@mock.patch('ly_test_tools._internal.managers.abstract_resource_locator._find_project_json', mock.MagicMock(
|
|
|
|
|
return_value=mock_project))
|
|
|
|
|
class TestWindowsResourceLocator(object):
|
|
|
|
|
|
|
|
|
|
def test_PlatformConfigFile_HasPath_ReturnsPath(self):
|
|
|
|
|
windows_resource_locator = ly_test_tools._internal.managers.platforms.windows._WindowsResourceLocator(
|
|
|
|
|
mock_build_directory, mock_project)
|
|
|
|
|
expected = os.path.join(
|
|
|
|
|
windows_resource_locator.engine_root(),
|
|
|
|
|
CONFIG_FILE)
|
|
|
|
|
@ -57,12 +52,16 @@ class TestWindowsResourceLocator(object):
|
|
|
|
|
assert windows_resource_locator.platform_config_file() == expected
|
|
|
|
|
|
|
|
|
|
def test_PlatformCache_HasPath_ReturnsPath(self):
|
|
|
|
|
windows_resource_locator = ly_test_tools._internal.managers.platforms.windows._WindowsResourceLocator(
|
|
|
|
|
mock_build_directory, mock_project)
|
|
|
|
|
expected = os.path.join(
|
|
|
|
|
windows_resource_locator.project_cache(), CACHE_DIR)
|
|
|
|
|
|
|
|
|
|
assert windows_resource_locator.platform_cache() == expected
|
|
|
|
|
|
|
|
|
|
def test_ProjectLog_HasPath_ReturnsPath(self):
|
|
|
|
|
windows_resource_locator = ly_test_tools._internal.managers.platforms.windows._WindowsResourceLocator(
|
|
|
|
|
mock_build_directory, mock_project)
|
|
|
|
|
expected = os.path.join(
|
|
|
|
|
windows_resource_locator.project(),
|
|
|
|
|
'user',
|
|
|
|
|
@ -71,6 +70,8 @@ class TestWindowsResourceLocator(object):
|
|
|
|
|
assert windows_resource_locator.project_log() == expected
|
|
|
|
|
|
|
|
|
|
def test_ProjectScreenshots_HasPath_ReturnsPath(self):
|
|
|
|
|
windows_resource_locator = ly_test_tools._internal.managers.platforms.windows._WindowsResourceLocator(
|
|
|
|
|
mock_build_directory, mock_project)
|
|
|
|
|
expected = os.path.join(
|
|
|
|
|
windows_resource_locator.project(),
|
|
|
|
|
'user',
|
|
|
|
|
@ -79,6 +80,8 @@ class TestWindowsResourceLocator(object):
|
|
|
|
|
assert windows_resource_locator.project_screenshots() == expected
|
|
|
|
|
|
|
|
|
|
def test_EditorLog_HasPath_ReturnsPath(self):
|
|
|
|
|
windows_resource_locator = ly_test_tools._internal.managers.platforms.windows._WindowsResourceLocator(
|
|
|
|
|
mock_build_directory, mock_project)
|
|
|
|
|
expected = os.path.join(
|
|
|
|
|
windows_resource_locator.project_log(),
|
|
|
|
|
'editor.log')
|
|
|
|
|
@ -87,17 +90,21 @@ class TestWindowsResourceLocator(object):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@mock.patch('ly_test_tools._internal.managers.abstract_resource_locator._find_engine_root',
|
|
|
|
|
mock.MagicMock(return_value=(mock_engine_root, mock_dev_path)))
|
|
|
|
|
mock.MagicMock(return_value=mock_engine_root))
|
|
|
|
|
@mock.patch('ly_test_tools._internal.managers.abstract_resource_locator._find_project_json', mock.MagicMock(
|
|
|
|
|
return_value=mock_project))
|
|
|
|
|
class TestWindowsWorkspaceManager(object):
|
|
|
|
|
|
|
|
|
|
@mock.patch('ly_test_tools.environment.reg_cleaner.create_ly_keys')
|
|
|
|
|
def test_SetRegistryKeys_NewWorkspaceManager_KeyCreateCalled(self, mock_create_keys):
|
|
|
|
|
windows_workspace_manager = ly_test_tools._internal.managers.platforms.windows.WindowsWorkspaceManager()
|
|
|
|
|
windows_workspace_manager.set_registry_keys()
|
|
|
|
|
|
|
|
|
|
mock_create_keys.assert_called_once()
|
|
|
|
|
|
|
|
|
|
@mock.patch('ly_test_tools.environment.reg_cleaner.clean_ly_keys')
|
|
|
|
|
def test_ClearSettings_NewWorkspaceManager_KeyClearCalled(self, mock_clear_keys):
|
|
|
|
|
windows_workspace_manager = ly_test_tools._internal.managers.platforms.windows.WindowsWorkspaceManager()
|
|
|
|
|
windows_workspace_manager.clear_settings()
|
|
|
|
|
|
|
|
|
|
mock_clear_keys.assert_called_with(exception_list=r"SOFTWARE\Amazon\Lumberyard\Identity")
|
|
|
|
|
|