From bc535dbc9b83cb7f77a3676d82973ca697947444 Mon Sep 17 00:00:00 2001 From: Heber Date: Mon, 25 Nov 2024 21:30:07 -0700 Subject: [PATCH] Correcting tests for permissions --- dlrs/main/classes/RollupCalculateJobTest.cls | 6 +++++- dlrs/main/classes/RollupJobTest.cls | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/dlrs/main/classes/RollupCalculateJobTest.cls b/dlrs/main/classes/RollupCalculateJobTest.cls index d125b95c..e6a6ab84 100644 --- a/dlrs/main/classes/RollupCalculateJobTest.cls +++ b/dlrs/main/classes/RollupCalculateJobTest.cls @@ -263,7 +263,11 @@ private class RollupCalculateJobTest { String jobId; System.runAs(new User(Id = UserInfo.getUserId())) { Test.startTest(); - Assert.isTrue(FeatureManagement.checkPermission(permName)); + Assert.areEqual( + true, + Utilities.userHasCustomPermission(permName), + 'Expected user to have ' + permName + ); // go into runAs because we need to get the perms recalculated jobId = Database.executeBatch(job); Test.stopTest(); diff --git a/dlrs/main/classes/RollupJobTest.cls b/dlrs/main/classes/RollupJobTest.cls index a24f730b..3768be3e 100644 --- a/dlrs/main/classes/RollupJobTest.cls +++ b/dlrs/main/classes/RollupJobTest.cls @@ -253,9 +253,10 @@ private class RollupJobTest { String jobId; System.runAs(new User(Id = UserInfo.getUserId())) { Test.startTest(); - Assert.isTrue( - FeatureManagement.checkPermission(permName), - 'Expected user to have the ' + permName + ' permission set' + Assert.areEqual( + true, + Utilities.userHasCustomPermission(permName), + 'Expected user to have ' + permName ); // go into runAs because we need to get the perms recalculated jobId = Database.executeBatch(new RollupJob());