Added UploadMediaFromReader
This commit is contained in:
parent
efa05aa949
commit
e804ee7eb2
3 changed files with 42 additions and 1 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue