1
0
mirror of https://github.com/rancher/steve.git synced 2025-09-15 14:58:52 +00:00

[main&2.10.3] Add schema links and resource methods for resource verb patch (#450)

* Show patch link on the API resource when patch permission is present and add patch ResourceMethod to the schema.

* Added tests for new functionality and corrected disallowed method for patch
This commit is contained in:
Chad Roberts
2025-02-14 06:12:17 -05:00
committed by GitHub
parent f51f89196c
commit 5b5db5c40f
4 changed files with 103 additions and 1 deletions

View File

@@ -38,6 +38,15 @@ func TestSchemas(t *testing.T) {
errDesired: false,
},
},
{
name: "basic patch schema test",
config: schemaTestConfig{
permissionVerbs: []string{"patch"},
desiredResourceVerbs: []string{"PATCH"},
desiredCollectionVerbs: []string{},
errDesired: false,
},
},
}
for _, test := range tests {
test := test
@@ -162,7 +171,7 @@ func makeSchema(resourceType string) *types.APISchema {
"group": testGroup,
"version": testVersion,
"resource": resourceType,
"verbs": []string{"get", "list", "watch", "delete", "update", "create"},
"verbs": []string{"get", "list", "watch", "delete", "update", "create", "patch"},
},
},
}