Add UploadMediaFromBytes function

This commit is contained in:
Darren O'Connor 2022-11-15 02:54:56 +00:00 committed by mattn
parent 309dce6ff3
commit e5c082de35
2 changed files with 18 additions and 1 deletions

View file

@ -708,6 +708,18 @@ func TestUploadMedia(t *testing.T) {
if writerAttachment.ID != "123" {
t.Fatalf("want %q but %q", "123", attachment.ID)
}
bytes, err := os.ReadFile("testdata/logo.png")
if err != nil {
t.Fatalf("could not open file: %v", err)
}
byteAttachment, err := client.UploadMediaFromBytes(context.Background(), bytes)
if err != nil {
t.Fatalf("should not be fail: %v", err)
}
if byteAttachment.ID != "123" {
t.Fatalf("want %q but got %q", "123", attachment.ID)
}
}
func TestGetConversations(t *testing.T) {