File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 9
9
"log"
10
10
"net/http"
11
11
"net/http/httptest"
12
+ "os"
12
13
"strconv"
13
14
"strings"
14
15
"testing"
@@ -22,15 +23,13 @@ const (
22
23
)
23
24
24
25
func TestAPI (t * testing.T ) {
25
- if testing .Short () {
26
- t .Skip ("skipping test in short mode" )
27
- }
28
- tokenBytes , err := ioutil .ReadFile (".openai-token" )
29
- if err != nil {
30
- t .Fatalf ("Could not load auth token from .openai-token file" )
26
+ apiToken := os .Getenv ("OPENAI_TOKEN" )
27
+ if apiToken == "" {
28
+ t .Skip ("Skipping testing against production OpenAI API. Set OPENAI_TOKEN environment variable to enable it." )
31
29
}
32
30
33
- c := NewClient (string (tokenBytes ))
31
+ var err error
32
+ c := NewClient (apiToken )
34
33
ctx := context .Background ()
35
34
_ , err = c .ListEngines (ctx )
36
35
if err != nil {
You can’t perform that action at this time.
0 commit comments