Skip to content

Commit

Permalink
Add Tests for #1165 Behavior. (#1173)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmarkowsky authored Sep 4, 2023
1 parent f016508 commit 5f0755e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Source/santad/SNTExecutionControllerTest.mm
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,23 @@ - (void)testBinaryAllowTransitiveRuleDisabled {
[self checkMetricCounters:kAllowTransitive expected:@0];
}

- (void)testThatPlatformBinaryCachedDecisionsSetModeCorrectly {
OCMStub([self.mockFileInfo isMachO]).andReturn(YES);
OCMStub([self.mockFileInfo SHA256]).andReturn(@"a");
OCMStub([self.mockConfigurator clientMode]).andReturn(SNTClientModeLockdown);
OCMStub([self.mockConfigurator enableTransitiveRules]).andReturn(NO);

SNTCachedDecision *cd = [[SNTCachedDecision alloc] init];
cd.decision = SNTEventStateAllowBinary;
OCMStub([self.mockRuleDatabase criticalSystemBinaries]).andReturn(@{@"a" : cd});

[self validateExecEvent:SNTActionRespondAllow];
[self checkMetricCounters:kAllowBinary expected:@1];
[self checkMetricCounters:kAllowUnknown expected:@0];

XCTAssertEqual(cd.decisionClientMode, SNTClientModeLockdown);
}

- (void)testDefaultDecision {
OCMStub([self.mockFileInfo isMachO]).andReturn(YES);
OCMStub([self.mockFileInfo SHA256]).andReturn(@"a");
Expand Down

0 comments on commit 5f0755e

Please sign in to comment.