Included security.rst as SecurityPolicy

* Included security.rst as name check for security policy.
This commit is contained in:
naveen 2021-07-04 18:54:09 +00:00 committed by Naveen
parent 68dc079b79
commit aeead94680
3 changed files with 34 additions and 0 deletions

View File

@ -34,6 +34,9 @@ func SecurityPolicy(c *checker.CheckRequest) checker.CheckResult {
if strings.EqualFold(name, "security.md") {
logf("security policy : %s", name)
return true, nil
} else if isSecurityrstFound(name) {
logf("security policy : %s", name)
return true, nil
}
return false, nil
}
@ -57,3 +60,12 @@ func SecurityPolicy(c *checker.CheckRequest) checker.CheckResult {
}
return CheckIfFileExists(CheckSecurityPolicy, dotGitHub, onFile)
}
func isSecurityrstFound(name string) bool {
if strings.EqualFold(name, "doc/security.rst") {
return true
} else if strings.EqualFold(name, "docs/security.rst") {
return true
}
return false
}

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//nolint: dupl // repeating test cases that are slightly different is acceptable
package e2e
import (

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//nolint:dupl // repeating test cases that are slightly different is acceptable
package e2e
import (
@ -47,5 +48,25 @@ var _ = Describe("E2E TEST:SecurityPolicy", func() {
Expect(result.Error).Should(BeNil())
Expect(result.Pass).Should(BeTrue())
})
It("Should return valid security policy for rust repositories", func() {
l := log{}
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), ghClient)
err := repoClient.InitRepo("randombit", "botan")
Expect(err).Should(BeNil())
checkRequest := checker.CheckRequest{
Ctx: context.Background(),
Client: ghClient,
HTTPClient: httpClient,
RepoClient: repoClient,
Owner: "randombit",
Repo: "botan",
GraphClient: graphClient,
Logf: l.Logf,
}
result := checks.SecurityPolicy(&checkRequest)
Expect(result.Error).Should(BeNil())
Expect(result.Pass).Should(BeTrue())
})
})
})