-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* first round of cleanup first round of cleanup * create helper funtion for conditions filter code create helper funtion for conditions filter code * add comments pt 1 add comments pt 1 add comments pt 2 add comments pt 2 * update syntax for constant update syntax for constant * update for test package update for test package * fix policy indicated comments fix policy indicated comments * fix json formatting & rego formatting fix json formatting & rego formatting * refactor out duplicate code in tests refactor out duplicate code in tests * remove unused imports remove unused imports * remove unused var remove unused var * remove constant
- Loading branch information
1 parent
535c9ef
commit 2c9c7a5
Showing
18 changed files
with
1,677 additions
and
1,395 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,94 +1,95 @@ | ||
package exo | ||
package exo_test | ||
import future.keywords | ||
import data.exo | ||
import data.report.utils.ReportDetailsBoolean | ||
|
||
|
||
CorrectTestResult(PolicyId, Output, ReportDetailString) := true if { | ||
RuleOutput := [Result | some Result in Output; Result.PolicyId == PolicyId] | ||
|
||
count(RuleOutput) == 1 | ||
RuleOutput[0].RequirementMet == true | ||
RuleOutput[0].ReportDetails == ReportDetailString | ||
} else := false | ||
|
||
IncorrectTestResult(PolicyId, Output, ReportDetailString) := true if { | ||
RuleOutput := [Result | some Result in Output; Result.PolicyId == PolicyId] | ||
|
||
count(RuleOutput) == 1 | ||
RuleOutput[0].RequirementMet == false | ||
RuleOutput[0].ReportDetails == ReportDetailString | ||
} else := false | ||
|
||
PASS := ReportDetailsBoolean(true) | ||
|
||
|
||
# | ||
# Policy 1 | ||
#-- | ||
test_AutoForwardEnabled_Correct if { | ||
PolicyId := "MS.EXO.1.1v1" | ||
|
||
Output := tests with input as { | ||
Output := exo.tests with input as { | ||
"remote_domains": [ | ||
{ | ||
"AutoForwardEnabled" : false, | ||
"DomainName" : "Test name" | ||
"AutoForwardEnabled": false, | ||
"DomainName": "Test name" | ||
} | ||
] | ||
} | ||
|
||
RuleOutput := [Result | Result = Output[_]; Result.PolicyId == PolicyId] | ||
|
||
count(RuleOutput) == 1 | ||
RuleOutput[0].RequirementMet | ||
RuleOutput[0].ReportDetails == "Requirement met" | ||
CorrectTestResult("MS.EXO.1.1v1", Output, PASS) == true | ||
} | ||
|
||
test_AutoForwardEnabled_Incorrect_V1 if { | ||
PolicyId := "MS.EXO.1.1v1" | ||
|
||
Output := tests with input as { | ||
Output := exo.tests with input as { | ||
"remote_domains": [ | ||
{ | ||
"AutoForwardEnabled" : true, | ||
"DomainName" : "Test name" | ||
"AutoForwardEnabled": true, | ||
"DomainName": "Test name" | ||
} | ||
] | ||
} | ||
|
||
RuleOutput := [Result | Result = Output[_]; Result.PolicyId == PolicyId] | ||
|
||
count(RuleOutput) == 1 | ||
not RuleOutput[0].RequirementMet | ||
RuleOutput[0].ReportDetails == "1 remote domain(s) that allows automatic forwarding: Test name" | ||
ReportDetailString := "1 remote domain(s) that allows automatic forwarding: Test name" | ||
IncorrectTestResult("MS.EXO.1.1v1", Output, ReportDetailString) == true | ||
} | ||
|
||
test_AutoForwardEnabled_Incorrect_V2 if { | ||
PolicyId := "MS.EXO.1.1v1" | ||
|
||
Output := tests with input as { | ||
Output := exo.tests with input as { | ||
"remote_domains": [ | ||
{ | ||
"AutoForwardEnabled" : true, | ||
"DomainName" : "Test name" | ||
"AutoForwardEnabled": true, | ||
"DomainName": "Test name" | ||
}, | ||
{ | ||
"AutoForwardEnabled" : true, | ||
"DomainName" : "Test name 2" | ||
"AutoForwardEnabled": true, | ||
"DomainName": "Test name 2" | ||
} | ||
] | ||
} | ||
|
||
RuleOutput := [Result | Result = Output[_]; Result.PolicyId == PolicyId] | ||
|
||
count(RuleOutput) == 1 | ||
not RuleOutput[0].RequirementMet | ||
RuleOutput[0].ReportDetails == "2 remote domain(s) that allows automatic forwarding: Test name, Test name 2" | ||
ReportDetailString := "2 remote domain(s) that allows automatic forwarding: Test name, Test name 2" | ||
IncorrectTestResult("MS.EXO.1.1v1", Output, ReportDetailString) == true | ||
} | ||
|
||
test_AutoForwardEnabled_Incorrect_V3 if { | ||
PolicyId := "MS.EXO.1.1v1" | ||
|
||
Output := tests with input as { | ||
Output := exo.tests with input as { | ||
"remote_domains": [ | ||
{ | ||
"AutoForwardEnabled" : true, | ||
"DomainName" : "Test name" | ||
"AutoForwardEnabled": true, | ||
"DomainName": "Test name" | ||
}, | ||
{ | ||
"AutoForwardEnabled" : true, | ||
"DomainName" : "Test name 2" | ||
"AutoForwardEnabled": true, | ||
"DomainName": "Test name 2" | ||
}, | ||
{ | ||
"AutoForwardEnabled" : false, | ||
"DomainName" : "Test name 3" | ||
"AutoForwardEnabled": false, | ||
"DomainName": "Test name 3" | ||
} | ||
] | ||
} | ||
|
||
RuleOutput := [Result | Result = Output[_]; Result.PolicyId == PolicyId] | ||
|
||
count(RuleOutput) == 1 | ||
not RuleOutput[0].RequirementMet | ||
RuleOutput[0].ReportDetails == "2 remote domain(s) that allows automatic forwarding: Test name, Test name 2" | ||
ReportDetailString := "2 remote domain(s) that allows automatic forwarding: Test name, Test name 2" | ||
IncorrectTestResult("MS.EXO.1.1v1", Output, ReportDetailString) == true | ||
} | ||
#-- |
Oops, something went wrong.