@@ -119,6 +119,7 @@ class VaultListDataPreparatorTests: BitwardenTestCase { // swiftlint:disable:thi
119119 )
120120
121121 XCTAssertEqual ( mockCallOrderHelper. callOrder, [
122+ " prepareRestrictItemsPolicyOrganizations " ,
122123 " addItemForGroup " ,
123124 ] )
124125 XCTAssertNotNil ( result)
@@ -147,6 +148,7 @@ class VaultListDataPreparatorTests: BitwardenTestCase { // swiftlint:disable:thi
147148 )
148149
149150 XCTAssertEqual ( mockCallOrderHelper. callOrder, [
151+ " prepareRestrictItemsPolicyOrganizations " ,
150152 " addFido2Item " ,
151153 ] )
152154 XCTAssertNotNil ( result)
@@ -156,7 +158,6 @@ class VaultListDataPreparatorTests: BitwardenTestCase { // swiftlint:disable:thi
156158 /// cipher as it doesn't pass restrict item type policy.
157159 @MainActor
158160 func test_prepareAutofillCombinedSingleData_doesNotPassRestrictItemPolicy( ) async throws {
159- configService. featureFlagsBool [ . removeCardPolicy] = true
160161 ciphersClientWrapperService. decryptAndProcessCiphersInBatchOnCipherParameterToPass = . fixture(
161162 id: " 1 " ,
162163 organizationId: " 1 " ,
@@ -201,7 +202,9 @@ class VaultListDataPreparatorTests: BitwardenTestCase { // swiftlint:disable:thi
201202 filter: VaultListFilter ( uri: " https://example.com " ) ,
202203 )
203204
204- XCTAssertTrue ( mockCallOrderHelper. callOrder. isEmpty)
205+ XCTAssertEqual ( mockCallOrderHelper. callOrder, [
206+ " prepareRestrictItemsPolicyOrganizations " ,
207+ ] )
205208 XCTAssertNotNil ( result)
206209 }
207210
@@ -228,6 +231,7 @@ class VaultListDataPreparatorTests: BitwardenTestCase { // swiftlint:disable:thi
228231 )
229232
230233 XCTAssertEqual ( mockCallOrderHelper. callOrder, [
234+ " prepareRestrictItemsPolicyOrganizations " ,
231235 " prepareFolders " ,
232236 " prepareCollections " ,
233237 " incrementTOTPCount " ,
@@ -254,6 +258,7 @@ class VaultListDataPreparatorTests: BitwardenTestCase { // swiftlint:disable:thi
254258 )
255259
256260 XCTAssertEqual ( mockCallOrderHelper. callOrder, [
261+ " prepareRestrictItemsPolicyOrganizations " ,
257262 " prepareFolders " ,
258263 " prepareCollections " ,
259264 " addCipherDecryptionFailure " ,
@@ -282,6 +287,7 @@ class VaultListDataPreparatorTests: BitwardenTestCase { // swiftlint:disable:thi
282287 )
283288
284289 XCTAssertEqual ( mockCallOrderHelper. callOrder, [
290+ " prepareRestrictItemsPolicyOrganizations " ,
285291 " prepareFolders " ,
286292 " prepareCollections " ,
287293 ] )
@@ -297,7 +303,6 @@ class VaultListDataPreparatorTests: BitwardenTestCase { // swiftlint:disable:thi
297303 organizationId: " 1 " ,
298304 type: . card( . fixture( ) ) ,
299305 )
300- configService. featureFlagsBool [ . removeCardPolicy] = true
301306 policyService. policyAppliesToUserPolicies = [ . fixture( organizationId: " 1 " ) ]
302307
303308 let result = try await subject. prepareData (
@@ -316,48 +321,14 @@ class VaultListDataPreparatorTests: BitwardenTestCase { // swiftlint:disable:thi
316321 }
317322
318323 /// `prepareData(from:collections:folders:filter:)` returns the prepared data without filtering out cipher even
319- /// with restricted item types policy but with `.removeCardPolicy` off.
320- @MainActor
321- func test_prepareData_preparedDataNoFilteringOutCipherWithRestrictedItemsPolicyButCardFlagOff( ) async throws {
322- ciphersClientWrapperService. decryptAndProcessCiphersInBatchOnCipherParameterToPass = . fixture(
323- organizationId: " 1 " ,
324- type: . card( . fixture( ) ) ,
325- )
326-
327- configService. featureFlagsBool [ . removeCardPolicy] = false
328- policyService. policyAppliesToUserPolicies = [ . fixture( organizationId: " 1 " ) ]
329-
330- let result = try await subject. prepareData (
331- from: [ . fixture( organizationId: " 1 " , type: . card) ] ,
332- collections: [ . fixture( id: " 1 " ) , . fixture( id: " 2 " ) ] ,
333- folders: [ . fixture( id: " 1 " ) , . fixture( id: " 2 " ) , . fixture( id: " 3 " ) ] ,
334- filter: VaultListFilter ( addTOTPGroup: true ) ,
335- )
336-
337- XCTAssertEqual ( mockCallOrderHelper. callOrder, [
338- " prepareFolders " ,
339- " prepareCollections " ,
340- " incrementTOTPCount " ,
341- " addCipherDecryptionFailure " ,
342- " addFolderItem " ,
343- " addFavoriteItem " ,
344- " addNoFolderItem " ,
345- " incrementCipherTypeCount " ,
346- " incrementCollectionCount " ,
347- ] )
348- XCTAssertNotNil ( result)
349- }
350-
351- /// `prepareData(from:collections:folders:filter:)` returns the prepared data without filtering out cipher even
352- /// with `.removeCardPolicy` flag on, restricted item types policy without matching organization.
324+ /// with restricted item types policy without matching organization.
353325 @MainActor
354326 func test_prepareData_preparedDataNoFilteringOutCipherWithRestrictedItemsPolicyNonMatchingOrgs( ) async throws {
355327 ciphersClientWrapperService. decryptAndProcessCiphersInBatchOnCipherParameterToPass = . fixture(
356328 organizationId: " 1 " ,
357329 type: . card( . fixture( ) ) ,
358330 )
359331
360- configService. featureFlagsBool [ . removeCardPolicy] = true
361332 policyService. policyAppliesToUserPolicies = [ . fixture( organizationId: " 2 " ) ]
362333
363334 let result = try await subject. prepareData (
@@ -399,6 +370,7 @@ class VaultListDataPreparatorTests: BitwardenTestCase { // swiftlint:disable:thi
399370 )
400371
401372 XCTAssertEqual ( mockCallOrderHelper. callOrder, [
373+ " prepareRestrictItemsPolicyOrganizations " ,
402374 " prepareFolders " ,
403375 " prepareCollections " ,
404376 " incrementCipherDeletedCount " ,
@@ -434,6 +406,7 @@ class VaultListDataPreparatorTests: BitwardenTestCase { // swiftlint:disable:thi
434406 )
435407
436408 XCTAssertEqual ( mockCallOrderHelper. callOrder, [
409+ " prepareRestrictItemsPolicyOrganizations " ,
437410 " prepareFolders " ,
438411 " prepareCollections " ,
439412 ] )
@@ -449,7 +422,6 @@ class VaultListDataPreparatorTests: BitwardenTestCase { // swiftlint:disable:thi
449422 organizationId: " 1 " ,
450423 type: . card( . fixture( ) ) ,
451424 )
452- configService. featureFlagsBool [ . removeCardPolicy] = true
453425 policyService. policyAppliesToUserPolicies = [ . fixture( organizationId: " 1 " ) ]
454426
455427 let result = try await subject. prepareGroupData (
@@ -480,6 +452,7 @@ class VaultListDataPreparatorTests: BitwardenTestCase { // swiftlint:disable:thi
480452
481453 // should not call incrementCollectionCount and addItemForGroup
482454 XCTAssertEqual ( mockCallOrderHelper. callOrder, [
455+ " prepareRestrictItemsPolicyOrganizations " ,
483456 " prepareFolders " ,
484457 " prepareCollections " ,
485458 ] )
@@ -501,6 +474,7 @@ class VaultListDataPreparatorTests: BitwardenTestCase { // swiftlint:disable:thi
501474 )
502475
503476 XCTAssertEqual ( mockCallOrderHelper. callOrder, [
477+ " prepareRestrictItemsPolicyOrganizations " ,
504478 " prepareFolders " ,
505479 " prepareCollections " ,
506480 " addFolderItem " ,
@@ -524,6 +498,7 @@ class VaultListDataPreparatorTests: BitwardenTestCase { // swiftlint:disable:thi
524498 )
525499
526500 XCTAssertEqual ( mockCallOrderHelper. callOrder, [
501+ " prepareRestrictItemsPolicyOrganizations " ,
527502 " prepareFolders " ,
528503 " prepareCollections " ,
529504 " incrementCollectionCount " ,
@@ -547,31 +522,15 @@ class VaultListDataPreparatorTests: BitwardenTestCase { // swiftlint:disable:thi
547522 }
548523
549524 /// `prepareGroupData(from:collections:folders:filter:)` returns the prepared data
550- /// when not filtering by folder nor collection with restricted items policy but `.removeCardPolicy` flag off.
551- @MainActor
552- func test_prepareGroupData_cardRestrictedItemsTypeCardFlagOff( ) async throws {
553- ciphersClientWrapperService. decryptAndProcessCiphersInBatchOnCipherParameterToPass = . fixture(
554- id: " 1 " ,
555- organizationId: " 1 " ,
556- type: . card( . fixture( ) ) ,
557- )
558- configService. featureFlagsBool [ . removeCardPolicy] = false
559- policyService. policyAppliesToUserPolicies = [ . fixture( organizationId: " 1 " ) ]
560-
561- try await prepareGroupDataGenericTest ( group: . card)
562- }
563-
564- /// `prepareGroupData(from:collections:folders:filter:)` returns the prepared data
565- /// when not filtering by folder nor collection with `.removeCardPolicy` flag on and restricted items policy
525+ /// when not filtering by folder nor collection with restricted items policy
566526 /// non-matching organization IDs.
567527 @MainActor
568- func test_prepareGroupData_cardWithCardFlagOffAndNonMatchingRestrictedItemsTypeOrgs ( ) async throws {
528+ func test_prepareGroupData_cardNonMatchingRestrictedItemsTypeOrgs ( ) async throws {
569529 ciphersClientWrapperService. decryptAndProcessCiphersInBatchOnCipherParameterToPass = . fixture(
570530 id: " 1 " ,
571531 organizationId: " 1 " ,
572532 type: . card( . fixture( ) ) ,
573533 )
574- configService. featureFlagsBool [ . removeCardPolicy] = true
575534 policyService. policyAppliesToUserPolicies = [ . fixture( organizationId: " 2 " ) ]
576535
577536 let result = try await subject. prepareGroupData (
@@ -627,17 +586,17 @@ class VaultListDataPreparatorTests: BitwardenTestCase { // swiftlint:disable:thi
627586 )
628587
629588 XCTAssertEqual ( mockCallOrderHelper. callOrder, [
589+ " prepareRestrictItemsPolicyOrganizations " ,
630590 " addItemWithMatchResultCipher " ,
631591 ] )
632592 XCTAssertNotNil ( result)
633593 XCTAssertEqual ( cipherMatchingHelper. doesCipherMatchReceivedCipher? . id, " 1 " )
634594 }
635595
636596 /// `prepareAutofillPasswordsData(from:filter:)` returns the prepared data filtering out cipher as it doesn't pass
637- /// restrict item type policy..
597+ /// restrict item type policy.
638598 @MainActor
639599 func test_prepareAutofillPasswordsData_doesNotPassRestrictItemPolicy( ) async throws {
640- configService. featureFlagsBool [ . removeCardPolicy] = true
641600 ciphersClientWrapperService. decryptAndProcessCiphersInBatchOnCipherParameterToPass = . fixture(
642601 id: " 1 " ,
643602 organizationId: " 1 " ,
@@ -685,6 +644,7 @@ class VaultListDataPreparatorTests: BitwardenTestCase { // swiftlint:disable:thi
685644 )
686645
687646 XCTAssertEqual ( mockCallOrderHelper. callOrder, [
647+ " prepareRestrictItemsPolicyOrganizations " ,
688648 ] )
689649 XCTAssertNotNil ( result)
690650 XCTAssertNil ( cipherMatchingHelper. doesCipherMatchReceivedCipher)
@@ -703,6 +663,7 @@ class VaultListDataPreparatorTests: BitwardenTestCase { // swiftlint:disable:thi
703663 )
704664
705665 XCTAssertEqual ( mockCallOrderHelper. callOrder, [
666+ " prepareRestrictItemsPolicyOrganizations " ,
706667 " prepareFolders " ,
707668 " prepareCollections " ,
708669 " addItemForGroup " ,
0 commit comments