-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathattachment_test.go
More file actions
51 lines (45 loc) · 885 Bytes
/
attachment_test.go
File metadata and controls
51 lines (45 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package docs
import (
"bytes"
"os"
"testing"
"github.com/go-lark/docs/doctypes"
"github.com/stretchr/testify/assert"
)
func TestAttachment_UpdateAll(t *testing.T) {
f := &bytes.Buffer{}
f.WriteString("test update file")
res, err := getAttachment().UpdateAll(
doctypes.AttachmentFile,
testDocToken,
"testfile.txt",
f.Bytes(),
)
assert.NoError(t, err)
t.Log(res)
}
func TestAttachment_UpdateResume(t *testing.T) {
fi, err := os.Stat(testBigFile)
assert.NoError(t, err)
f, err := os.Open(testBigFile)
assert.NoError(t, err)
ch := make(chan int64, 20)
go func() {
for v := range ch {
t.Log("process: ", v)
}
}()
resp, err := getAttachment().UpdateResuming(
doctypes.AttachmentFile,
testDocToken,
fi.Name(),
fi.Size(),
f,
ch,
)
assert.NoError(t, err)
t.Log(resp)
}
func getAttachment() *Attachment {
return getClient().attachment()
}