@@ -377,6 +377,31 @@ TEST_CASE("ListFlow_JsonOutputWithSettingsWarnings", "[ListFlow][workflow]")
377377 REQUIRE (json[" packages" ].size () == 1 );
378378}
379379
380+ TEST_CASE (" ListFlow_JsonOutputWinGetPolicyDisabled" , " [ListFlow][workflow]" )
381+ {
382+ GroupPolicyTestOverride policies;
383+ policies.SetState (TogglePolicy::Policy::WinGet, PolicyState::Disabled);
384+
385+ std::ostringstream listOutput;
386+ TestContext context{ listOutput, std::cin };
387+ auto previousThreadGlobals = context.SetForCurrentThread ();
388+ context.Args .AddArg (Execution::Args::Type::OutputFormat, " json" sv);
389+
390+ ListCommand list ({});
391+ context.SetExecutingCommand (&list);
392+ ExecuteWithoutLoggingSuccess (context, &list);
393+ INFO (listOutput.str ());
394+
395+ Json::Value json = ConvertToJson (listOutput.str ());
396+ REQUIRE (json[" packages" ].isArray ());
397+ REQUIRE (json[" packages" ].empty ());
398+ REQUIRE (json[" sourceFailures" ].isArray ());
399+ REQUIRE (json[" sourceFailures" ].empty ());
400+ REQUIRE (json[" error" ][" code" ].asString () == " 0x8a15003a" );
401+ REQUIRE (json[" error" ][" message" ].asString ().empty () == false );
402+ REQUIRE (context.GetTerminationHR () == APPINSTALLER_CLI_ERROR_BLOCKED_BY_POLICY );
403+ }
404+
380405TEST_CASE (" ListFlow_JsonOutputBadSource" , " [ListFlow][workflow]" )
381406{
382407 SetSetting (Stream::UserSources, R"(
0 commit comments