(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func TestParseReqParam(t *testing.T) { |
| 11 | |
| 12 | testcases := []struct { |
| 13 | name string |
| 14 | expected map[string]string |
| 15 | request string |
| 16 | expectedError error |
| 17 | allowDeleteBodyV bool |
| 18 | allowMergeV bool |
| 19 | includePackageInTagsV bool |
| 20 | fileV string |
| 21 | importPathV string |
| 22 | mergeFileNameV string |
| 23 | useFQNForOpenAPINameV bool |
| 24 | openAPINamingStrategyV string |
| 25 | }{ |
| 26 | { |
| 27 | // this one must be first - with no leading clearFlags call it |
| 28 | // verifies our expectation of default values as we reset by |
| 29 | // clearFlags |
| 30 | name: "Test 0", |
| 31 | expected: map[string]string{}, |
| 32 | request: "", |
| 33 | allowDeleteBodyV: false, |
| 34 | allowMergeV: false, |
| 35 | includePackageInTagsV: false, |
| 36 | fileV: "-", |
| 37 | importPathV: "", |
| 38 | mergeFileNameV: "apidocs", |
| 39 | }, |
| 40 | { |
| 41 | name: "Test 1", |
| 42 | expected: map[string]string{"google/api/annotations.proto": "github.com/googleapis/googleapis/google/api"}, |
| 43 | request: "allow_delete_body,allow_merge,allow_repeated_fields_in_body,include_package_in_tags,file=./foo.pb,import_prefix=/bar/baz,Mgoogle/api/annotations.proto=github.com/googleapis/googleapis/google/api", |
| 44 | allowDeleteBodyV: true, |
| 45 | allowMergeV: true, |
| 46 | includePackageInTagsV: true, |
| 47 | fileV: "./foo.pb", |
| 48 | importPathV: "/bar/baz", |
| 49 | mergeFileNameV: "apidocs", |
| 50 | }, |
| 51 | { |
| 52 | name: "Test 2", |
| 53 | expected: map[string]string{"google/api/annotations.proto": "github.com/googleapis/googleapis/google/api"}, |
| 54 | request: "allow_delete_body=true,allow_merge=true,allow_repeated_fields_in_body=true,include_package_in_tags=true,merge_file_name=test_name,file=./foo.pb,import_prefix=/bar/baz,Mgoogle/api/annotations.proto=github.com/googleapis/googleapis/google/api", |
| 55 | allowDeleteBodyV: true, |
| 56 | allowMergeV: true, |
| 57 | includePackageInTagsV: true, |
| 58 | fileV: "./foo.pb", |
| 59 | importPathV: "/bar/baz", |
| 60 | mergeFileNameV: "test_name", |
| 61 | }, |
| 62 | { |
| 63 | name: "Test 3", |
| 64 | expected: map[string]string{"a/b/c.proto": "github.com/x/y/z", "f/g/h.proto": "github.com/1/2/3/"}, |
| 65 | request: "allow_delete_body=false,allow_merge=false,Ma/b/c.proto=github.com/x/y/z,Mf/g/h.proto=github.com/1/2/3/", |
| 66 | allowDeleteBodyV: false, |
| 67 | allowMergeV: false, |
nothing calls this directly
no test coverage detected