From 5ad9f14da498367a4e7fbc91c4902969550d39f3 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 +- test/run_stage_test.go | 2 +- v2/go.mod | 4 +--- v2/go.sum | 21 +++++++++++++++++++++ v2/test/report_stage_test.go | 2 +- v2/test/run_stage_test.go | 2 +- v2/test/run_test.go | 2 +- 8 files changed, 27 insertions(+), 9 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/test/run_stage_test.go b/test/run_stage_test.go index 8db23cc..7e5e31a 100644 --- a/test/run_stage_test.go +++ b/test/run_stage_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/owenrumney/go-sarif/sarif" + "github.com/owenrumney/go-sarif/v2/sarif" "github.com/stretchr/testify/assert" ) diff --git a/v2/go.mod b/v2/go.mod index 74e3bd8..34ecb7f 100644 --- a/v2/go.mod +++ b/v2/go.mod @@ -3,8 +3,6 @@ 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/owenrumney/go-sarif v1.1.1 github.com/stretchr/testify v1.7.0 - gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect ) diff --git a/v2/go.sum b/v2/go.sum index dc03bd5..dbac08c 100644 --- a/v2/go.sum +++ b/v2/go.sum @@ -1,16 +1,37 @@ +github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= 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/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 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/owenrumney/go-sarif v1.1.1 h1:QNObu6YX1igyFKhdzd7vgzmw7XsWN3/6NMGuDzBgXmE= +github.com/owenrumney/go-sarif v1.1.1/go.mod h1:dNDiPlF04ESR/6fHlPyq7gHKmrM0sHUvAGjsoh8ZH0U= 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= +github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4= +github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= +github.com/zclconf/go-cty v1.10.0 h1:mp9ZXQeIcN8kAwuqorjH+Q+njbJKjLrvB2yIh4q7U+0= +github.com/zclconf/go-cty v1.10.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= 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= diff --git a/v2/test/report_stage_test.go b/v2/test/report_stage_test.go index 013e4cc..8cc6188 100644 --- a/v2/test/report_stage_test.go +++ b/v2/test/report_stage_test.go @@ -4,7 +4,7 @@ import ( "bytes" "testing" - "github.com/owenrumney/go-sarif/v2/sarif" + "github.com/owenrumney/go-sarif/sarif" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) 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()