fix: decouple meeting note upload binding

This commit is contained in:
richjohnrambo
2026-09-17 13:38:55 +08:00
parent 734e042af6
commit 8279ae577f
2 changed files with 10 additions and 28 deletions
+8 -7
View File
@@ -210,7 +210,7 @@ func TestLargeFileGarbageCollectTenantsScopesDeletes(t *testing.T) {
largeFileGarbageCollectTenants([]types.TenantID{7, 8}, olderThan, 25)
}
func TestLargeFileReceiveMeetingNoteUploadCreatesNoteFile(t *testing.T) {
func TestLargeFileReceiveMeetingNoteUploadReturnsFileID(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
@@ -229,17 +229,15 @@ func TestLargeFileReceiveMeetingNoteUploadCreatesNoteFile(t *testing.T) {
mockStore := mock_store.NewMockPersistentStorageInterface(ctrl)
tokenAuth := mock_auth.NewMockAuthHandler(ctrl)
files := mock_store.NewMockFilePersistenceInterface(ctrl)
notes := &testMeetingNotesStore{}
store.Store = mockStore
store.Files = files
store.MeetingNotes = notes
store.MeetingNotes = nil
kafkaBus = nil
fileID := types.Uid(101)
mockStore.EXPECT().GetMediaHandler().Return(handler).AnyTimes()
mockStore.EXPECT().GetLogicalAuthHandler("token").Return(tokenAuth)
mockStore.EXPECT().GetUidString().Return(fileID.String())
mockStore.EXPECT().GetUidString().Return("note-1")
tokenAuth.EXPECT().Authenticate(auth.AuthContext{RemoteAddr: "192.0.2.1:12345"}, []byte("token-1")).
Return(&auth.Rec{TenantID: 7, Uid: 42, AuthLevel: auth.LevelAuth}, nil, nil)
files.EXPECT().FinishUpload(types.TenantID(7), gomock.Any(), true, int64(11)).DoAndReturn(
@@ -289,10 +287,13 @@ func TestLargeFileReceiveMeetingNoteUploadCreatesNoteFile(t *testing.T) {
}
params := resp.Ctrl.Params.(map[string]any)
if params["file_id"] != fileID.String() || params["purpose"] != fileUploadPurposeMeetingNote ||
params["meeting_id"] != "mtg_test" || params["note_file_id"] != "mnote_note-1" {
params["meeting_id"] != "mtg_test" {
t.Fatalf("unexpected upload params: %#v", params)
}
if handler.data != "hello notes" || handler.def.OriginalName != "notes.txt" || notes.createdFileID != fileID.String() || notes.createdMeetingID != "mtg_test" || notes.createdIdempotencyKey != "upload-meeting-note-1" {
t.Fatalf("unexpected side effects: handler=%#v notes=%#v", handler, notes)
if _, ok := params["note_file_id"]; ok {
t.Fatalf("upload should not bind meeting note file: %#v", params)
}
if handler.data != "hello notes" || handler.def.OriginalName != "notes.txt" {
t.Fatalf("unexpected side effects: handler=%#v", handler)
}
}