Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
Signed-off-by: Ihor Hrytskiv <[email protected]>
  • Loading branch information
ihor-hrytskiv committed Sep 4, 2024
1 parent b700143 commit 2a80399
Showing 1 changed file with 90 additions and 0 deletions.
90 changes: 90 additions & 0 deletions github/orgs_rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,18 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoNames(t *testing.T)
"operator": "contains",
"pattern": "github"
}
},
{
"type": "code_scanning",
"parameters": {
"code_scanning_tools": [
{
"tool": "CodeQL",
"security_alerts_threshold": "high_or_higher",
"alerts_threshold": "errors"
}
]
}
}
]
}`)
Expand Down Expand Up @@ -292,6 +304,15 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoNames(t *testing.T)
Operator: "contains",
Pattern: "github",
}),
NewRequiredCodeScanningRule(&RequiredCodeScanningRuleParameters{
RequiredCodeScanningTools: []*RuleRequiredCodeScanningTools{
{
Tool: "CodeQL",
SecurityAlertsThreshold: "high_or_higher",
AlertsThreshold: "errors",
},
},
}),
},
})
if err != nil {
Expand Down Expand Up @@ -379,6 +400,15 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoNames(t *testing.T)
Operator: "contains",
Pattern: "github",
}),
NewRequiredCodeScanningRule(&RequiredCodeScanningRuleParameters{
RequiredCodeScanningTools: []*RuleRequiredCodeScanningTools{
{
Tool: "CodeQL",
SecurityAlertsThreshold: "high_or_higher",
AlertsThreshold: "errors",
},
},
}),
},
}
if !cmp.Equal(ruleset, want) {
Expand Down Expand Up @@ -531,6 +561,18 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoProperty(t *testing.
"operator": "contains",
"pattern": "github"
}
},
{
"type": "code_scanning",
"parameters": {
"code_scanning_tools": [
{
"tool": "CodeQL",
"security_alerts_threshold": "high_or_higher",
"alerts_threshold": "errors"
}
]
}
}
]
}`)
Expand Down Expand Up @@ -625,6 +667,15 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoProperty(t *testing.
Operator: "contains",
Pattern: "github",
}),
NewRequiredCodeScanningRule(&RequiredCodeScanningRuleParameters{
RequiredCodeScanningTools: []*RuleRequiredCodeScanningTools{
{
Tool: "CodeQL",
SecurityAlertsThreshold: "high_or_higher",
AlertsThreshold: "errors",
},
},
}),
},
})
if err != nil {
Expand Down Expand Up @@ -719,6 +770,15 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoProperty(t *testing.
Operator: "contains",
Pattern: "github",
}),
NewRequiredCodeScanningRule(&RequiredCodeScanningRuleParameters{
RequiredCodeScanningTools: []*RuleRequiredCodeScanningTools{
{
Tool: "CodeQL",
SecurityAlertsThreshold: "high_or_higher",
AlertsThreshold: "errors",
},
},
}),
},
}
if !cmp.Equal(ruleset, want) {
Expand Down Expand Up @@ -863,6 +923,18 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoIDs(t *testing.T) {
"operator": "contains",
"pattern": "github"
}
},
{
"type": "code_scanning",
"parameters": {
"code_scanning_tools": [
{
"tool": "CodeQL",
"security_alerts_threshold": "high_or_higher",
"alerts_threshold": "errors"
}
]
}
}
]
}`)
Expand Down Expand Up @@ -948,6 +1020,15 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoIDs(t *testing.T) {
Operator: "contains",
Pattern: "github",
}),
NewRequiredCodeScanningRule(&RequiredCodeScanningRuleParameters{
RequiredCodeScanningTools: []*RuleRequiredCodeScanningTools{
{
Tool: "CodeQL",
SecurityAlertsThreshold: "high_or_higher",
AlertsThreshold: "errors",
},
},
}),
},
})
if err != nil {
Expand Down Expand Up @@ -1033,6 +1114,15 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoIDs(t *testing.T) {
Operator: "contains",
Pattern: "github",
}),
NewRequiredCodeScanningRule(&RequiredCodeScanningRuleParameters{
RequiredCodeScanningTools: []*RuleRequiredCodeScanningTools{
{
Tool: "CodeQL",
SecurityAlertsThreshold: "high_or_higher",
AlertsThreshold: "errors",
},
},
}),
},
}
if !cmp.Equal(ruleset, want) {
Expand Down

0 comments on commit 2a80399

Please sign in to comment.