Skip to content

Commit

Permalink
Allow TestAccessControl to run with ARL (#35262)
Browse files Browse the repository at this point in the history
* Allow TestAccessControl to run with ARL

Since RequestType is required, set each test data entry to some
value that will pass AccessRestrictionProvider checks (since the
focus is on AccessControl for these tests).

* Copy the test data's request path and optionally add RequestType
  • Loading branch information
tleacmcsa authored and pull[bot] committed Feb 17, 2025
1 parent b51bde0 commit 2357497
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/access/tests/TestAccessControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1752,7 +1752,11 @@ TEST_F(TestAccessControl, TestCheck)
for (const auto & checkData : checkData1)
{
CHIP_ERROR expectedResult = checkData.allow ? CHIP_NO_ERROR : CHIP_ERROR_ACCESS_DENIED;
EXPECT_EQ(accessControl.Check(checkData.subjectDescriptor, checkData.requestPath, checkData.privilege), expectedResult);
auto requestPath = checkData.requestPath;
#if CHIP_CONFIG_USE_ACCESS_RESTRICTIONS
requestPath.requestType = Access::RequestType::kAttributeReadRequest;
#endif
EXPECT_EQ(accessControl.Check(checkData.subjectDescriptor, requestPath, checkData.privilege), expectedResult);
}
}

Expand Down

0 comments on commit 2357497

Please sign in to comment.