From ea9337683ae91d24400c0733c11b611f11a80eb3 Mon Sep 17 00:00:00 2001 From: Ryan Fu <69221034+ryfu-msft@users.noreply.github.com> Date: Thu, 23 Jun 2022 18:18:22 -0700 Subject: [PATCH] Fix unsupported args unit tests (#2277) --- .../ManifestV1_2-MultiFile-Installer.yaml | 4 ++-- src/AppInstallerCLITests/WorkFlow.cpp | 8 +++++--- src/AppInstallerCLITests/YamlManifest.cpp | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/AppInstallerCLITests/TestData/MultiFileManifestV1_2/ManifestV1_2-MultiFile-Installer.yaml b/src/AppInstallerCLITests/TestData/MultiFileManifestV1_2/ManifestV1_2-MultiFile-Installer.yaml index 50e34df00f..b3cc2afbb0 100644 --- a/src/AppInstallerCLITests/TestData/MultiFileManifestV1_2/ManifestV1_2-MultiFile-Installer.yaml +++ b/src/AppInstallerCLITests/TestData/MultiFileManifestV1_2/ManifestV1_2-MultiFile-Installer.yaml @@ -139,6 +139,8 @@ Installers: - InstallerReturnCode: 3 ReturnResponse: custom ReturnResponseUrl: https://defaultReturnResponseUrl.com + UnsupportedArguments: + - location - Architecture: x64 InstallerType: exe InstallerUrl: https://www.microsoft.com/msixsdk/msixsdkx64.exe @@ -155,7 +157,5 @@ Installers: - InstallerReturnCode: 11 ReturnResponse: custom ReturnResponseUrl: https://defaultReturnResponseUrl.com - UnsupportedArguments: - - location ManifestType: installer ManifestVersion: 1.2.0 \ No newline at end of file diff --git a/src/AppInstallerCLITests/WorkFlow.cpp b/src/AppInstallerCLITests/WorkFlow.cpp index f16898a725..3ef1934624 100644 --- a/src/AppInstallerCLITests/WorkFlow.cpp +++ b/src/AppInstallerCLITests/WorkFlow.cpp @@ -898,8 +898,9 @@ TEST_CASE("InstallFlow_UnsupportedArguments_NotProvided") // Verify unsupported arguments error message is not shown when not provided REQUIRE(context.GetTerminationHR() == S_OK); REQUIRE(std::filesystem::exists(installResultPath.GetPath())); - REQUIRE(installOutput.str().find(Resource::LocString(Resource::String::UnsupportedArgument).get() + " -o,--log") == std::string::npos); - REQUIRE(installOutput.str().find(Resource::LocString(Resource::String::UnsupportedArgument).get() + " -l,--location") == std::string::npos); + REQUIRE(installOutput.str().find(Resource::LocString(Resource::String::UnsupportedArgument).get()) == std::string::npos); + REQUIRE(installOutput.str().find("-o,--log") == std::string::npos); + REQUIRE(installOutput.str().find("-l,--location") == std::string::npos); } TEST_CASE("InstallFlow_ExpectedReturnCodes", "[InstallFlow][workflow]") @@ -1637,7 +1638,8 @@ TEST_CASE("UpdateFlow_UpdateExeWithUnsupportedArgs", "[UpdateFlow][workflow]") // Verify unsupported arguments error message is shown REQUIRE(context.GetTerminationHR() == APPINSTALLER_CLI_ERROR_UNSUPPORTED_ARGUMENT); REQUIRE(!std::filesystem::exists(updateResultPath.GetPath())); - REQUIRE(updateOutput.str().find(Resource::LocString(Resource::String::UnsupportedArgument).get() + " -l,--location") != std::string::npos); + REQUIRE(updateOutput.str().find(Resource::LocString(Resource::String::UnsupportedArgument).get()) != std::string::npos); + REQUIRE(updateOutput.str().find("-l,--location") != std::string::npos); } TEST_CASE("UpdateFlow_UpdatePortableWithManifest", "[UpdateFlow][workflow]") diff --git a/src/AppInstallerCLITests/YamlManifest.cpp b/src/AppInstallerCLITests/YamlManifest.cpp index 68293c4294..912c6f6965 100644 --- a/src/AppInstallerCLITests/YamlManifest.cpp +++ b/src/AppInstallerCLITests/YamlManifest.cpp @@ -547,7 +547,7 @@ void VerifyV1ManifestContent(const Manifest& manifest, bool isSingleton, Manifes REQUIRE(installer1.ExpectedReturnCodes.at(3).ReturnResponseEnum == ExpectedReturnCodeEnum::Custom); REQUIRE(installer1.ExpectedReturnCodes.at(3).ReturnResponseUrl == "https://defaultReturnResponseUrl.com"); REQUIRE(installer1.UnsupportedArguments.size() == 1); - REQUIRE(installer1.UnsupportedArguments.at(1) == UnsupportedArgumentEnum::Location); + REQUIRE(installer1.UnsupportedArguments.at(0) == UnsupportedArgumentEnum::Location); } if (!isSingleton) @@ -594,7 +594,7 @@ void VerifyV1ManifestContent(const Manifest& manifest, bool isSingleton, Manifes REQUIRE(installer3.ExpectedReturnCodes.at(11).ReturnResponseUrl == "https://defaultReturnResponseUrl.com"); REQUIRE_FALSE(installer3.DisplayInstallWarnings); REQUIRE(installer3.UnsupportedArguments.size() == 1); - REQUIRE(installer3.UnsupportedArguments.at(0) == UnsupportedArgumentEnum::Location); + REQUIRE(installer3.UnsupportedArguments.at(0) == UnsupportedArgumentEnum::Log); } // Localization