fixing ly_test_tools function and unit tests

This commit is contained in:
evanchia
2021-06-16 10:02:36 -07:00
parent 7c28b1ff86
commit 009e96d601
5 changed files with 90 additions and 33 deletions
@@ -14,6 +14,7 @@ Unit tests for ly_test_tools._internal.managers.platforms.mac
import unittest.mock as mock
import os
import pytest
import ly_test_tools
from ly_test_tools._internal.managers.platforms.mac import (
_MacResourceLocator, MacWorkspaceManager,
@@ -22,11 +23,6 @@ from ly_test_tools import MAC
pytestmark = pytest.mark.SUITE_smoke
if not MAC:
pytestmark = pytest.mark.skipif(
not MAC,
reason="test_manager_platforms_mac.py only runs on Mac")
mock_engine_root = 'mock_engine_root'
mock_dev_path = 'mock_dev_path'
mock_build_directory = 'mock_build_directory'
@@ -34,16 +30,16 @@ mock_project = 'mock_project'
mock_tmp_path = 'mock_tmp_path'
mock_output_path = 'mock_output_path'
mac_resource_locator = _MacResourceLocator(
build_directory=mock_build_directory,
project=mock_project)
@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 TestMacResourceLocator(object):
def test_PlatformConfigFile_HasPath_ReturnsPath(self):
mac_resource_locator = ly_test_tools._internal.managers.platforms.mac._MacResourceLocator(mock_build_directory,
mock_project)
expected = os.path.join(
mac_resource_locator.engine_root(),
CONFIG_FILE)
@@ -51,6 +47,8 @@ class TestMacResourceLocator(object):
assert mac_resource_locator.platform_config_file() == expected
def test_PlatformCache_HasPath_ReturnsPath(self):
mac_resource_locator = ly_test_tools._internal.managers.platforms.mac._MacResourceLocator(mock_build_directory,
mock_project)
expected = os.path.join(
mac_resource_locator.project_cache(),
CACHE_DIR)
@@ -58,6 +56,8 @@ class TestMacResourceLocator(object):
assert mac_resource_locator.platform_cache() == expected
def test_ProjectLog_HasPath_ReturnsPath(self):
mac_resource_locator = ly_test_tools._internal.managers.platforms.mac._MacResourceLocator(mock_build_directory,
mock_project)
expected = os.path.join(
mac_resource_locator.project(),
'user',
@@ -66,6 +66,8 @@ class TestMacResourceLocator(object):
assert mac_resource_locator.project_log() == expected
def test_ProjectScreenshots_HasPath_ReturnsPath(self):
mac_resource_locator = ly_test_tools._internal.managers.platforms.mac._MacResourceLocator(mock_build_directory,
mock_project)
expected = os.path.join(
mac_resource_locator.project(),
'user',
@@ -74,6 +76,8 @@ class TestMacResourceLocator(object):
assert mac_resource_locator.project_screenshots() == expected
def test_EditorLog_HasPath_ReturnsPath(self):
mac_resource_locator = ly_test_tools._internal.managers.platforms.mac._MacResourceLocator(mock_build_directory,
mock_project)
expected = os.path.join(
mac_resource_locator.project_log(),
'editor.log')
@@ -82,7 +86,9 @@ class TestMacResourceLocator(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 TestMacWorkspaceManager(object):
def test_Init_SetDummyParams_ReturnsMacWorkspaceManager(self):