mirror of
https://github.com/anchore/syft
synced 2024-11-15 00:27:07 +00:00
706322f826
* add initial spdx support Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * expose FileOwner and use in SPDX presenter Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * add initial json support for SPDX Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * add remaining package fields Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * add spdx license list generation + tests Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * keep fileOwner unexported from pkg Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * restore cli test util Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * add external refs to spdx tag-value format Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * add golang support to CPE generation Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * use tag-value format as default "spdx" format flavor Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * add tests around spdx presenters + refactor presenter tests Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * add bouncer exception for spdx tools-golang repo Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * remove spdx model questions Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
36 lines
946 B
Go
36 lines
946 B
Go
package integration
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
"testing"
|
|
|
|
"github.com/anchore/syft/internal/spdxlicense"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestSPDXLicenseListIsTheLatest(t *testing.T) {
|
|
resp, err := http.Get("https://spdx.org/licenses/licenses.json")
|
|
if err != nil {
|
|
t.Fatalf("unable to get licenses list: %+v", err)
|
|
}
|
|
|
|
type licenseList struct {
|
|
Version string `json:"licenseListVersion"`
|
|
Licenses []struct {
|
|
ID string `json:"licenseId"`
|
|
Name string `json:"name"`
|
|
Text string `json:"licenseText"`
|
|
Deprecated bool `json:"isDeprecatedLicenseId"`
|
|
OSIApproved bool `json:"isOsiApproved"`
|
|
SeeAlso []string `json:"seeAlso"`
|
|
} `json:"licenses"`
|
|
}
|
|
|
|
var latest licenseList
|
|
if err = json.NewDecoder(resp.Body).Decode(&latest); err != nil {
|
|
t.Fatalf("unable to decode license list: %+v", err)
|
|
}
|
|
|
|
assert.Equal(t, latest.Version, spdxlicense.Version)
|
|
}
|