MCPcopy
hub / github.com/openai/openai-go / TestFileListWithOptionalParams

Function TestFileListWithOptionalParams

file_test.go:72–98  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

70}
71
72func TestFileListWithOptionalParams(t *testing.T) {
73 baseURL := "http://localhost:4010"
74 if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
75 baseURL = envURL
76 }
77 if !testutil.CheckTestServer(t, baseURL) {
78 return
79 }
80 client := openai.NewClient(
81 option.WithBaseURL(baseURL),
82 option.WithAPIKey("My API Key"),
83 option.WithAdminAPIKey("My Admin API Key"),
84 )
85 _, err := client.Files.List(context.TODO(), openai.FileListParams{
86 After: openai.String("after"),
87 Limit: openai.Int(0),
88 Order: openai.FileListParamsOrderAsc,
89 Purpose: openai.String("purpose"),
90 })
91 if err != nil {
92 var apierr *openai.Error
93 if errors.As(err, &apierr) {
94 t.Log(string(apierr.DumpRequest(true)))
95 }
96 t.Fatalf("err should be nil: %s", err.Error())
97 }
98}
99
100func TestFileDelete(t *testing.T) {
101 baseURL := "http://localhost:4010"

Callers

nothing calls this directly

Calls 8

DumpRequestMethod · 0.95
CheckTestServerFunction · 0.92
WithBaseURLFunction · 0.92
WithAPIKeyFunction · 0.92
WithAdminAPIKeyFunction · 0.92
ListMethod · 0.45
StringMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…