MCPcopy Create free account
hub / github.com/QuantumNous/new-api / taskPluginOptionsHasKey

Function taskPluginOptionsHasKey

controller/task_plugin_test.go:201–221  ·  view source on GitHub ↗
(t *testing.T, key string)

Source from the content-addressed store, hash-verified

199}
200
201func taskPluginOptionsHasKey(t *testing.T, key string) bool {
202 t.Helper()
203 recorder := httptest.NewRecorder()
204 context, _ := gin.CreateTestContext(recorder)
205 context.Request = httptest.NewRequest(http.MethodGet, "/api/task_plugin_options", nil)
206 GetTaskPluginOptions(context)
207 var response struct {
208 Success bool `json:"success"`
209 Data []struct {
210 Key string `json:"key"`
211 } `json:"data"`
212 }
213 require.NoError(t, common.Unmarshal(recorder.Body.Bytes(), &response))
214 require.True(t, response.Success)
215 for _, option := range response.Data {
216 if option.Key == key {
217 return true
218 }
219 }
220 return false
221}
222
223func TestDisableFactoryPluginPersistsOptionAndHidesFromBindOptions(t *testing.T) {
224 setupTaskPluginFactoryDisableTest(t)

Calls 3

UnmarshalFunction · 0.92
GetTaskPluginOptionsFunction · 0.85
BytesMethod · 0.65

Tested by

no test coverage detected