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

Function taskPluginOptionsHasKey

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

Source from the content-addressed store, hash-verified

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

Calls 3

UnmarshalFunction · 0.92
GetTaskPluginOptionsFunction · 0.85
BytesMethod · 0.65

Tested by

no test coverage detected