/* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or the license accompanying this file. Do not * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * */ #include #include #include #include #include #include #include namespace O3DE::ProjectManager { class PythonBindingsTests : public ::UnitTest::ScopedAllocatorSetupFixture { public: PythonBindingsTests() { const AZStd::string engineRootPath{ AZ::Test::GetEngineRootPath() }; m_pythonBindings = AZStd::make_unique(AZ::IO::PathView(engineRootPath)); } ~PythonBindingsTests() { m_pythonBindings.reset(); } AZStd::unique_ptr m_pythonBindings; }; TEST_F(PythonBindingsTests, PythonBindings_Start_Python_Succeeds) { EXPECT_TRUE(m_pythonBindings->PythonStarted()); } TEST_F(PythonBindingsTests, PythonBindings_Create_Project_Succeeds) { ASSERT_TRUE(m_pythonBindings->PythonStarted()); auto templateResults = m_pythonBindings->GetProjectTemplates(); ASSERT_TRUE(templateResults.IsSuccess()); QVector templates = templateResults.GetValue(); ASSERT_FALSE(templates.isEmpty()); // use the first registered template QString templatePath = templates.at(0).m_path; AZ::Test::ScopedAutoTempDirectory tempDir; ProjectInfo projectInfo; projectInfo.m_path = QDir::toNativeSeparators(QString(tempDir.GetDirectory()) + "/" + "TestProject"); projectInfo.m_projectName = "TestProjectName"; auto result = m_pythonBindings->CreateProject(templatePath, projectInfo); EXPECT_TRUE(result.IsSuccess()); ProjectInfo resultProjectInfo = result.GetValue(); EXPECT_EQ(projectInfo.m_path, resultProjectInfo.m_path); EXPECT_EQ(projectInfo.m_projectName, resultProjectInfo.m_projectName); } }