2021-05-10 09:08:04 +01:00
|
|
|
package cwe_test
|
|
|
|
|
|
|
|
import (
|
2022-01-03 17:11:35 +00:00
|
|
|
. "github.com/onsi/ginkgo/v2"
|
2021-05-10 09:08:04 +01:00
|
|
|
. "github.com/onsi/gomega"
|
2023-03-30 08:31:24 +01:00
|
|
|
|
2021-05-10 09:08:04 +01:00
|
|
|
"github.com/securego/gosec/v2/cwe"
|
|
|
|
)
|
|
|
|
|
|
|
|
var _ = Describe("CWE Types", func() {
|
|
|
|
BeforeEach(func() {
|
|
|
|
})
|
|
|
|
Context("when consulting cwe types", func() {
|
|
|
|
It("it should retrieves the information and download URIs", func() {
|
2021-06-13 12:30:16 +01:00
|
|
|
Expect(cwe.InformationURI).To(Equal("https://cwe.mitre.org/data/published/cwe_v4.4.pdf/"))
|
|
|
|
Expect(cwe.DownloadURI).To(Equal("https://cwe.mitre.org/data/xml/cwec_v4.4.xml.zip"))
|
2021-05-10 09:08:04 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
It("it should retrieves the weakness ID and URL", func() {
|
|
|
|
weakness := &cwe.Weakness{ID: "798"}
|
|
|
|
Expect(weakness).ShouldNot(BeNil())
|
|
|
|
Expect(weakness.SprintID()).To(Equal("CWE-798"))
|
|
|
|
Expect(weakness.SprintURL()).To(Equal("https://cwe.mitre.org/data/definitions/798.html"))
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|