-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't enable/disable admin settings if group policy prevents it (#2683)
- Loading branch information
1 parent
de94283
commit caadda4
Showing
8 changed files
with
132 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
#include "pch.h" | ||
#include "TestCommon.h" | ||
#include "TestSettings.h" | ||
#include <winget/AdminSettings.h> | ||
|
||
using namespace AppInstaller::Settings; | ||
using namespace TestCommon; | ||
|
||
TEST_CASE("AdminSetting_Enable", "[adminSettings]") | ||
{ | ||
WHEN("Group policy") | ||
{ | ||
SECTION("Not configured") | ||
{ | ||
GroupPolicyTestOverride policies; | ||
policies.SetState(TogglePolicy::Policy::LocalManifestFiles, PolicyState::NotConfigured); | ||
REQUIRE(EnableAdminSetting(AdminSetting::LocalManifestFiles)); | ||
} | ||
|
||
SECTION("Enabled") | ||
{ | ||
GroupPolicyTestOverride policies; | ||
policies.SetState(TogglePolicy::Policy::LocalManifestFiles, PolicyState::Enabled); | ||
REQUIRE(EnableAdminSetting(AdminSetting::LocalManifestFiles)); | ||
} | ||
|
||
SECTION("Disabled") | ||
{ | ||
GroupPolicyTestOverride policies; | ||
policies.SetState(TogglePolicy::Policy::LocalManifestFiles, PolicyState::Disabled); | ||
REQUIRE_FALSE(EnableAdminSetting(AdminSetting::LocalManifestFiles)); | ||
} | ||
} | ||
} | ||
|
||
TEST_CASE("AdminSetting_Disable", "[adminSettings]") | ||
{ | ||
WHEN("Group policy") | ||
{ | ||
SECTION("Not configured") | ||
{ | ||
GroupPolicyTestOverride policies; | ||
policies.SetState(TogglePolicy::Policy::LocalManifestFiles, PolicyState::NotConfigured); | ||
REQUIRE(DisableAdminSetting(AdminSetting::LocalManifestFiles)); | ||
} | ||
|
||
SECTION("Enabled") | ||
{ | ||
GroupPolicyTestOverride policies; | ||
policies.SetState(TogglePolicy::Policy::LocalManifestFiles, PolicyState::Enabled); | ||
REQUIRE_FALSE(DisableAdminSetting(AdminSetting::LocalManifestFiles)); | ||
} | ||
|
||
SECTION("Disabled") | ||
{ | ||
GroupPolicyTestOverride policies; | ||
policies.SetState(TogglePolicy::Policy::LocalManifestFiles, PolicyState::Disabled); | ||
REQUIRE(DisableAdminSetting(AdminSetting::LocalManifestFiles)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters