Modify the test module, add the file upload test, and add the image edit api (#63)

* Modify the test module, add the file upload test, and add the image editing api

* fix golangci-lint

* fix golangci-lint

* Static file deletion, file directory name modification

* fix

* test-server-related logic encapsulated in a single tidy
 struct

---------

Co-authored-by: julian_huang <julian.huang@yuansuan.com>
This commit is contained in:
Rascal0814
2023-02-12 02:51:53 +08:00
committed by GitHub
parent ae06df7d9f
commit 5191ea6f55
12 changed files with 719 additions and 426 deletions

View File

@@ -1,12 +1,13 @@
package gogpt_test
import (
. "github.com/sashabaranov/go-gpt3"
"github.com/sashabaranov/go-gpt3/internal/test"
"context"
"net/http"
"net/http/httptest"
"testing"
. "github.com/sashabaranov/go-gpt3"
)
func TestCreateCompletionStream(t *testing.T) {
@@ -36,7 +37,7 @@ func TestCreateCompletionStream(t *testing.T) {
defer server.Close()
// Client portion of the test
client := NewClient(testAPIToken)
client := NewClient(test.GetTestToken())
ctx := context.Background()
client.BaseURL = server.URL + "/v1"
@@ -48,7 +49,7 @@ func TestCreateCompletionStream(t *testing.T) {
}
client.HTTPClient.Transport = &tokenRoundTripper{
testAPIToken,
test.GetTestToken(),
http.DefaultTransport,
}