From 117fa07cb36b8388481c480f1874ee590c3a0a7f Mon Sep 17 00:00:00 2001 From: Ink33 Date: Sun, 13 Aug 2023 20:58:00 +0800 Subject: [PATCH] license: add MIT header Signed-off-by: Ink33 --- docs/api-testing-schema.json | 2 +- pkg/compare/compare.go | 20 ++++++++++++++++++++ pkg/compare/compare_test.go | 20 ++++++++++++++++++++ pkg/compare/error.go | 20 ++++++++++++++++++++ pkg/compare/error_test.go | 20 ++++++++++++++++++++ pkg/runner/grpc.go | 20 ++++++++++++++++++++ pkg/runner/grpc_test.go | 20 ++++++++++++++++++++ pkg/runner/runner_factory.go | 20 ++++++++++++++++++++ pkg/runner/verify.go | 20 ++++++++++++++++++++ pkg/testing/case.go | 16 ++++++++-------- sample/grpc-sample.yaml | 2 +- 11 files changed, 170 insertions(+), 10 deletions(-) diff --git a/docs/api-testing-schema.json b/docs/api-testing-schema.json index d73aaf3d..7adb74bf 100644 --- a/docs/api-testing-schema.json +++ b/docs/api-testing-schema.json @@ -73,7 +73,7 @@ "protoset": { "type": "string" }, - "server_reflection": { + "serverReflection": { "type": "boolean" } } diff --git a/pkg/compare/compare.go b/pkg/compare/compare.go index e686f7fe..ce9ac521 100644 --- a/pkg/compare/compare.go +++ b/pkg/compare/compare.go @@ -1,3 +1,23 @@ +/* +MIT License +Copyright (c) 2023 API Testing Authors. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + // Package compare provides basic functions to compare JSON object and array. // Currently we use gjson to store the JSON data. Please check tidwall/gjson. package compare diff --git a/pkg/compare/compare_test.go b/pkg/compare/compare_test.go index 42b13afe..9422855e 100644 --- a/pkg/compare/compare_test.go +++ b/pkg/compare/compare_test.go @@ -1,3 +1,23 @@ +/* +MIT License +Copyright (c) 2023 API Testing Authors. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + package compare import ( diff --git a/pkg/compare/error.go b/pkg/compare/error.go index 2ab391a0..168c1bde 100644 --- a/pkg/compare/error.go +++ b/pkg/compare/error.go @@ -1,3 +1,23 @@ +/* +MIT License +Copyright (c) 2023 API Testing Authors. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + package compare import ( diff --git a/pkg/compare/error_test.go b/pkg/compare/error_test.go index c5da8f35..c03a4b25 100644 --- a/pkg/compare/error_test.go +++ b/pkg/compare/error_test.go @@ -1,3 +1,23 @@ +/* +MIT License +Copyright (c) 2023 API Testing Authors. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + package compare import ( diff --git a/pkg/runner/grpc.go b/pkg/runner/grpc.go index a15905b5..dea79612 100644 --- a/pkg/runner/grpc.go +++ b/pkg/runner/grpc.go @@ -1,3 +1,23 @@ +/* +MIT License +Copyright (c) 2023 API Testing Authors. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + package runner import ( diff --git a/pkg/runner/grpc_test.go b/pkg/runner/grpc_test.go index 3366d7e5..5d0de49b 100644 --- a/pkg/runner/grpc_test.go +++ b/pkg/runner/grpc_test.go @@ -1,3 +1,23 @@ +/* +MIT License +Copyright (c) 2023 API Testing Authors. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + package runner // TODO diff --git a/pkg/runner/runner_factory.go b/pkg/runner/runner_factory.go index 66e02fb9..b691cc23 100644 --- a/pkg/runner/runner_factory.go +++ b/pkg/runner/runner_factory.go @@ -1,3 +1,23 @@ +/* +MIT License +Copyright (c) 2023 API Testing Authors. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + package runner import "github.com/linuxsuren/api-testing/pkg/testing" diff --git a/pkg/runner/verify.go b/pkg/runner/verify.go index 1e80b584..a13c9dd2 100644 --- a/pkg/runner/verify.go +++ b/pkg/runner/verify.go @@ -1,3 +1,23 @@ +/* +MIT License +Copyright (c) 2023 API Testing Authors. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + package runner import ( diff --git a/pkg/testing/case.go b/pkg/testing/case.go index 0dbf16b1..ad2b7722 100644 --- a/pkg/testing/case.go +++ b/pkg/testing/case.go @@ -16,7 +16,7 @@ type APISpec struct { } type GRPCDesc struct { ImportPath []string `yaml:"import,omitempty" json:"import,omitempty"` - ServerReflection bool `yaml:"server_reflection,omitempty" json:"server_reflection,omitempty"` + ServerReflection bool `yaml:"serverReflection,omitempty" json:"serverReflection,omitempty"` ProtoFile string `yaml:"protofile,omitempty" json:"protofile,omitempty"` ProtoSet string `yaml:"protoset,omitempty" json:"protoset,omitempty"` } @@ -53,13 +53,13 @@ type Job struct { // Request represents a HTTP request type Request struct { - API string `yaml:"api" json:"api"` - Method string `yaml:"method,omitempty" json:"method,omitempty" jsonschema:"enum=GET,enum=POST,enum=PUT,enum=DELETE"` - Query map[string]string `yaml:"query,omitempty" json:"query,omitempty"` - Header map[string]string `yaml:"header,omitempty" json:"header,omitempty"` - Form map[string]string `yaml:"form,omitempty" json:"form,omitempty"` - Body string `yaml:"body,omitempty" json:"body,omitempty"` - BodyFromFile string `yaml:"bodyFromFile,omitempty" json:"bodyFromFile,omitempty"` + API string `yaml:"api" json:"api"` + Method string `yaml:"method,omitempty" json:"method,omitempty" jsonschema:"enum=GET,enum=POST,enum=PUT,enum=DELETE"` + Query map[string]string `yaml:"query,omitempty" json:"query,omitempty"` + Header map[string]string `yaml:"header,omitempty" json:"header,omitempty"` + Form map[string]string `yaml:"form,omitempty" json:"form,omitempty"` + Body string `yaml:"body,omitempty" json:"body,omitempty"` + BodyFromFile string `yaml:"bodyFromFile,omitempty" json:"bodyFromFile,omitempty"` } // Response is the expected response diff --git a/sample/grpc-sample.yaml b/sample/grpc-sample.yaml index 9b486df1..57099483 100644 --- a/sample/grpc-sample.yaml +++ b/sample/grpc-sample.yaml @@ -8,7 +8,7 @@ spec: import: - ./pkg/server protofile: server.proto - server_reflection: false + serverReflection: false items: - name: GetVersion request: