Fix group file metadata and access
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"encoding/base64"
|
||||
"encoding/binary"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"mime/multipart"
|
||||
"net/http"
|
||||
@@ -4501,8 +4502,9 @@ func TestServeIMGroupFiles(t *testing.T) {
|
||||
TenantID: 7, User: types.Uid(42).String(), Topic: "grpAlpha", ModeWant: types.ModeCFull, ModeGiven: types.ModeCFull,
|
||||
}, nil).Times(3)
|
||||
|
||||
fileID := types.Uid(101).String()
|
||||
createReq := httptest.NewRequest(http.MethodPost, "/v1/im/groups/grpAlpha/files",
|
||||
strings.NewReader(`{"file_id":"file1","file_name":"方案.pdf","file_type":"document","file_size":123}`))
|
||||
strings.NewReader(fmt.Sprintf(`{"file_id":"%s.pdf","file_name":"方案.pdf","file_type":"document","file_size":123}`, fileID)))
|
||||
createReq.Header.Set("Authorization", "Bearer token-1")
|
||||
createReq.Header.Set("Idempotency-Key", "gfile-1")
|
||||
createRec := httptest.NewRecorder()
|
||||
@@ -4511,7 +4513,7 @@ func TestServeIMGroupFiles(t *testing.T) {
|
||||
t.Fatalf("create status: got %d body=%s", createRec.Code, createRec.Body.String())
|
||||
}
|
||||
created := decodeIMHTTPResponse(t, createRec).Data.(map[string]any)
|
||||
if created["file_id"] != "file1" || created["file_type"] != "document" {
|
||||
if created["file_id"] != fileID || created["file_type"] != "document" {
|
||||
t.Fatalf("unexpected create response: %#v", created)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user