Skip to content

Commit

Permalink
Fix unsupported args unit tests (#2277)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryfu-msft authored Jun 24, 2022
1 parent bf009e7 commit ea93376
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -155,7 +157,5 @@ Installers:
- InstallerReturnCode: 11
ReturnResponse: custom
ReturnResponseUrl: https://defaultReturnResponseUrl.com
UnsupportedArguments:
- location
ManifestType: installer
ManifestVersion: 1.2.0
8 changes: 5 additions & 3 deletions src/AppInstallerCLITests/WorkFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]")
Expand Down Expand Up @@ -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]")
Expand Down
4 changes: 2 additions & 2 deletions src/AppInstallerCLITests/YamlManifest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ea93376

Please sign in to comment.