Added UploadMediaFromReader

This commit is contained in:
Brian C. Lindner 2019-03-10 22:55:15 -04:00 committed by mattn
parent efa05aa949
commit e804ee7eb2
3 changed files with 42 additions and 1 deletions

View file

@ -6,6 +6,7 @@ import (
"net/http"
"net/http/httptest"
"testing"
"os"
)
func TestGetFavourites(t *testing.T) {
@ -549,4 +550,13 @@ func TestUploadMedia(t *testing.T) {
if attachment.ID != "123" {
t.Fatalf("want %q but %q", "123", attachment.ID)
}
file, err := os.Open("testdata/logo.png")
defer file.Close()
writerAttachment, err := client.UploadMediaFromReader(context.Background(), file)
if err != nil {
t.Fatalf("should not be fail: %v", err)
}
if writerAttachment.ID != "123" {
t.Fatalf("want %q but %q", "123", attachment.ID)
}
}