mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-30 18:17:55 +00:00 
			
		
		
		
	This reverts commit 02064eccb4.
			
			
This commit is contained in:
		 Anton Averchenkov
					Anton Averchenkov
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							467067371d
						
					
				
				
					commit
					20f66ef7dd
				
			| @@ -271,7 +271,7 @@ func TestOpenAPI_SpecialPaths(t *testing.T) { | ||||
| 			Root:            test.rootPaths, | ||||
| 			Unauthenticated: test.unauthPaths, | ||||
| 		} | ||||
| 		err := documentPath(&path, sp, "kv", logical.TypeLogical, doc) | ||||
| 		err := documentPath(&path, sp, "kv", false, logical.TypeLogical, doc) | ||||
| 		if err != nil { | ||||
| 			t.Fatal(err) | ||||
| 		} | ||||
| @@ -517,32 +517,39 @@ func TestOpenAPI_OperationID(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
|  | ||||
| 	doc := NewOASDocument() | ||||
| 	err := documentPath(path1, nil, "kv", logical.TypeLogical, doc) | ||||
| 	if err != nil { | ||||
| 		t.Fatal(err) | ||||
| 	} | ||||
| 	err = documentPath(path2, nil, "kv", logical.TypeLogical, doc) | ||||
| 	if err != nil { | ||||
| 		t.Fatal(err) | ||||
| 	} | ||||
| 	for _, context := range []string{"", "bar"} { | ||||
| 		doc := NewOASDocument() | ||||
| 		err := documentPath(path1, nil, "kv", false, logical.TypeLogical, doc) | ||||
| 		if err != nil { | ||||
| 			t.Fatal(err) | ||||
| 		} | ||||
| 		err = documentPath(path2, nil, "kv", false, logical.TypeLogical, doc) | ||||
| 		if err != nil { | ||||
| 			t.Fatal(err) | ||||
| 		} | ||||
| 		doc.CreateOperationIDs(context) | ||||
|  | ||||
| 	tests := []struct { | ||||
| 		path string | ||||
| 		op   string | ||||
| 		opID string | ||||
| 	}{ | ||||
| 		{"/Foo/{id}", "get", "readSecretFooId"}, | ||||
| 		{"/foo/{id}", "post", "updateSecretFooId"}, | ||||
| 		{"/foo/{id}", "delete", "deleteSecretFooId"}, | ||||
| 	} | ||||
| 		tests := []struct { | ||||
| 			path string | ||||
| 			op   string | ||||
| 			opID string | ||||
| 		}{ | ||||
| 			{"/Foo/{id}", "get", "getFooId"}, | ||||
| 			{"/foo/{id}", "get", "getFooId_2"}, | ||||
| 			{"/foo/{id}", "post", "postFooId"}, | ||||
| 			{"/foo/{id}", "delete", "deleteFooId"}, | ||||
| 		} | ||||
|  | ||||
| 	for _, test := range tests { | ||||
| 		actual := getPathOp(doc.Paths[test.path], test.op).OperationID | ||||
| 		expected := test.opID | ||||
| 		for _, test := range tests { | ||||
| 			actual := getPathOp(doc.Paths[test.path], test.op).OperationID | ||||
| 			expected := test.opID | ||||
| 			if context != "" { | ||||
| 				expected += "_" + context | ||||
| 			} | ||||
|  | ||||
| 		if actual != expected { | ||||
| 			t.Fatalf("expected %v, got %v", expected, actual) | ||||
| 			if actual != expected { | ||||
| 				t.Fatalf("expected %v, got %v", expected, actual) | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| @@ -576,7 +583,7 @@ func TestOpenAPI_CustomDecoder(t *testing.T) { | ||||
| 	} | ||||
|  | ||||
| 	docOrig := NewOASDocument() | ||||
| 	err := documentPath(p, nil, "kv", logical.TypeLogical, docOrig) | ||||
| 	err := documentPath(p, nil, "kv", false, logical.TypeLogical, docOrig) | ||||
| 	if err != nil { | ||||
| 		t.Fatal(err) | ||||
| 	} | ||||
| @@ -639,9 +646,10 @@ func testPath(t *testing.T, path *Path, sp *logical.Paths, expectedJSON string) | ||||
| 	t.Helper() | ||||
|  | ||||
| 	doc := NewOASDocument() | ||||
| 	if err := documentPath(path, sp, "kv", logical.TypeLogical, doc); err != nil { | ||||
| 	if err := documentPath(path, sp, "kv", false, logical.TypeLogical, doc); err != nil { | ||||
| 		t.Fatal(err) | ||||
| 	} | ||||
| 	doc.CreateOperationIDs("") | ||||
|  | ||||
| 	docJSON, err := json.MarshalIndent(doc, "", "  ") | ||||
| 	if err != nil { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user