44using Bit . Core . AdminConsole . OrganizationFeatures . OrganizationDomains . Interfaces ;
55using Bit . Core . AdminConsole . OrganizationFeatures . Policies . Models ;
66using Bit . Core . AdminConsole . OrganizationFeatures . Policies . PolicyValidators ;
7- using Bit . Core . Services ;
87using Bit . Core . Test . AdminConsole . AutoFixture ;
98using Bit . Test . Common . AutoFixture ;
109using Bit . Test . Common . AutoFixture . Attributes ;
@@ -20,10 +19,6 @@ public async Task ValidateAsync_EnablingPolicy_NoVerifiedDomains_ValidationError
2019 SutProvider < BlockClaimedDomainAccountCreationPolicyValidator > sutProvider )
2120 {
2221 // Arrange
23- sutProvider . GetDependency < IFeatureService > ( )
24- . IsEnabled ( FeatureFlagKeys . BlockClaimedDomainAccountCreation )
25- . Returns ( true ) ;
26-
2722 sutProvider . GetDependency < IOrganizationHasVerifiedDomainsQuery > ( )
2823 . HasVerifiedDomainsAsync ( policyUpdate . OrganizationId )
2924 . Returns ( false ) ;
@@ -41,10 +36,6 @@ public async Task ValidateAsync_EnablingPolicy_HasVerifiedDomains_Success(
4136 SutProvider < BlockClaimedDomainAccountCreationPolicyValidator > sutProvider )
4237 {
4338 // Arrange
44- sutProvider . GetDependency < IFeatureService > ( )
45- . IsEnabled ( FeatureFlagKeys . BlockClaimedDomainAccountCreation )
46- . Returns ( true ) ;
47-
4839 sutProvider . GetDependency < IOrganizationHasVerifiedDomainsQuery > ( )
4940 . HasVerifiedDomainsAsync ( policyUpdate . OrganizationId )
5041 . Returns ( true ) ;
@@ -61,11 +52,6 @@ public async Task ValidateAsync_DisablingPolicy_NoValidation(
6152 [ PolicyUpdate ( PolicyType . BlockClaimedDomainAccountCreation , false ) ] PolicyUpdate policyUpdate ,
6253 SutProvider < BlockClaimedDomainAccountCreationPolicyValidator > sutProvider )
6354 {
64- // Arrange
65- sutProvider . GetDependency < IFeatureService > ( )
66- . IsEnabled ( FeatureFlagKeys . BlockClaimedDomainAccountCreation )
67- . Returns ( true ) ;
68-
6955 // Act
7056 var result = await sutProvider . Sut . ValidateAsync ( policyUpdate , null ) ;
7157
@@ -82,10 +68,6 @@ public async Task ValidateAsync_WithSavePolicyModel_EnablingPolicy_NoVerifiedDom
8268 SutProvider < BlockClaimedDomainAccountCreationPolicyValidator > sutProvider )
8369 {
8470 // Arrange
85- sutProvider . GetDependency < IFeatureService > ( )
86- . IsEnabled ( FeatureFlagKeys . BlockClaimedDomainAccountCreation )
87- . Returns ( true ) ;
88-
8971 sutProvider . GetDependency < IOrganizationHasVerifiedDomainsQuery > ( )
9072 . HasVerifiedDomainsAsync ( policyUpdate . OrganizationId )
9173 . Returns ( false ) ;
@@ -105,10 +87,6 @@ public async Task ValidateAsync_WithSavePolicyModel_EnablingPolicy_HasVerifiedDo
10587 SutProvider < BlockClaimedDomainAccountCreationPolicyValidator > sutProvider )
10688 {
10789 // Arrange
108- sutProvider . GetDependency < IFeatureService > ( )
109- . IsEnabled ( FeatureFlagKeys . BlockClaimedDomainAccountCreation )
110- . Returns ( true ) ;
111-
11290 sutProvider . GetDependency < IOrganizationHasVerifiedDomainsQuery > ( )
11391 . HasVerifiedDomainsAsync ( policyUpdate . OrganizationId )
11492 . Returns ( true ) ;
@@ -128,10 +106,6 @@ public async Task ValidateAsync_WithSavePolicyModel_DisablingPolicy_NoValidation
128106 SutProvider < BlockClaimedDomainAccountCreationPolicyValidator > sutProvider )
129107 {
130108 // Arrange
131- sutProvider . GetDependency < IFeatureService > ( )
132- . IsEnabled ( FeatureFlagKeys . BlockClaimedDomainAccountCreation )
133- . Returns ( true ) ;
134-
135109 var savePolicyModel = new SavePolicyModel ( policyUpdate , null , new EmptyMetadataModel ( ) ) ;
136110
137111 // Act
@@ -144,31 +118,11 @@ await sutProvider.GetDependency<IOrganizationHasVerifiedDomainsQuery>()
144118 . HasVerifiedDomainsAsync ( Arg . Any < Guid > ( ) ) ;
145119 }
146120
147- [ Theory , BitAutoData ]
148- public async Task ValidateAsync_FeatureFlagDisabled_ReturnsError (
149- [ PolicyUpdate ( PolicyType . BlockClaimedDomainAccountCreation , true ) ] PolicyUpdate policyUpdate ,
150- SutProvider < BlockClaimedDomainAccountCreationPolicyValidator > sutProvider )
151- {
152- // Arrange
153- sutProvider . GetDependency < IFeatureService > ( )
154- . IsEnabled ( FeatureFlagKeys . BlockClaimedDomainAccountCreation )
155- . Returns ( false ) ;
156-
157- // Act
158- var result = await sutProvider . Sut . ValidateAsync ( policyUpdate , null ) ;
159-
160- // Assert
161- Assert . Equal ( "This feature is not enabled" , result ) ;
162- await sutProvider . GetDependency < IOrganizationHasVerifiedDomainsQuery > ( )
163- . DidNotReceive ( )
164- . HasVerifiedDomainsAsync ( Arg . Any < Guid > ( ) ) ;
165- }
166-
167121 [ Fact ]
168122 public void Type_ReturnsBlockClaimedDomainAccountCreation ( )
169123 {
170124 // Arrange
171- var validator = new BlockClaimedDomainAccountCreationPolicyValidator ( null , null ) ;
125+ var validator = new BlockClaimedDomainAccountCreationPolicyValidator ( null ) ;
172126
173127 // Act & Assert
174128 Assert . Equal ( PolicyType . BlockClaimedDomainAccountCreation , validator . Type ) ;
@@ -178,7 +132,7 @@ public void Type_ReturnsBlockClaimedDomainAccountCreation()
178132 public void RequiredPolicies_ReturnsEmpty ( )
179133 {
180134 // Arrange
181- var validator = new BlockClaimedDomainAccountCreationPolicyValidator ( null , null ) ;
135+ var validator = new BlockClaimedDomainAccountCreationPolicyValidator ( null ) ;
182136
183137 // Act
184138 var requiredPolicies = validator . RequiredPolicies . ToList ( ) ;
0 commit comments