Fixes #440 - changes the few tests that are exercising CRUD/FLS enforcement to prefer the 'Minimum Access - Salesforce' profile since that is a more reliable Profile in most modern orgs #482
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
My first cut at fixing this bug was to try to find an SObject that the Read Only profile DIDN'T grant Read access to. Well, that was a fool's errand because even though there were some Standard Objects that didn't have Object Read access, the FLS on the object granted Read access to every field on those Standard Objects.
I backed away from trying to find a way to thread that needle and instead applied a bit more of a pragmatic approach. Rather than preferring the 'Read Only' profile and if it doesn't exist, create a Minimum Access user and assign them a well-known set of Perms via a Perm Set, let's just start with that (i.e. always prefer the Minimum Access user)
There are potential regressions here for orgs that don't have the Minimum Access profile which does exist out in the wild. Those orgs will fall back to the 'Read Only' profile .. and it's likely that the same tests that are broken as reported in #440 will continue to be broken. But at least this patch fixes the more common case of people not being able to get a clean test run if they create a brand spanking new Developer Edition org (not scratch org)
I tested this on a clean DE org and on a Scratch Org of edition Developer -- tests pass cleanly in both (and prior to this fix, the tests failed as outlined in #440 in the DE org)
This change is