From 24587d8f18670308985e30d1b1df9de61f3c62e2 Mon Sep 17 00:00:00 2001 From: Owen Rumney Date: Fri, 10 Dec 2021 15:49:10 +0000 Subject: [PATCH] fix test --- example/go.mod | 1 - example/main.go | 2 +- v2/go.mod | 7 +------ v2/go.sum | 11 ++--------- v2/test/run_stage_test.go | 2 +- v2/test/run_test.go | 2 +- 6 files changed, 6 insertions(+), 19 deletions(-) diff --git a/example/go.mod b/example/go.mod index cd67b19..2cf4049 100644 --- a/example/go.mod +++ b/example/go.mod @@ -4,4 +4,3 @@ go 1.17 replace github.com/owenrumney/go-sarif/v2 => ../v2 -require github.com/owenrumney/go-sarif/v2 v2.0.0 diff --git a/example/main.go b/example/main.go index a9e9696..c853894 100644 --- a/example/main.go +++ b/example/main.go @@ -44,7 +44,7 @@ func main() { } // create a run for tfsec - run := sarif.NewRun("tfsec", "https://tfsec.dev") + run := sarif.NewRunWithInformationURI("tfsec", "https://tfsec.dev") // for each result, add the for _, r := range tfsecResults.Results { diff --git a/v2/go.mod b/v2/go.mod index 74e3bd8..629e388 100644 --- a/v2/go.mod +++ b/v2/go.mod @@ -2,9 +2,4 @@ module github.com/owenrumney/go-sarif/v2 go 1.16 -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/kr/pretty v0.1.0 // indirect - github.com/stretchr/testify v1.7.0 - gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect -) +require github.com/stretchr/testify v1.7.0 diff --git a/v2/go.sum b/v2/go.sum index dc03bd5..acb88a4 100644 --- a/v2/go.sum +++ b/v2/go.sum @@ -1,18 +1,11 @@ +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/v2/test/run_stage_test.go b/v2/test/run_stage_test.go index 7e5e31a..7b6c0fb 100644 --- a/v2/test/run_stage_test.go +++ b/v2/test/run_stage_test.go @@ -27,7 +27,7 @@ func newRunTest(t *testing.T) (*runTest, *runTest, *runTest) { } func (r *runTest) a_result_is_added() { - r.run.AddResult("rule1") + r.run.CreateResultForRule("rule1") } func (r *runTest) properties_added_to_a_run() { diff --git a/v2/test/run_test.go b/v2/test/run_test.go index 7d80191..6ded48c 100644 --- a/v2/test/run_test.go +++ b/v2/test/run_test.go @@ -11,7 +11,7 @@ func Test_new_result_on_run(t *testing.T) { func Test_properties_on_a_run(t *testing.T) { given, when, then := newRunTest(t) - expected := `{"tool":{"driver":null},"results":[],"properties":{"boolean_key":false,"string_key":"string_value"}}` + expected := `{"properties":{"boolean_key":false,"string_key":"string_value"},"results":[],"tool":{"driver":null}}` given.properties_added_to_a_run() when.the_run_is_json()