fix creating tweet with media
This commit is contained in:
parent
d55ecabeec
commit
d81d7bb87a
2 changed files with 46 additions and 7 deletions
|
|
@ -28,6 +28,42 @@ func TestCreateTweet(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestCreateTweetWithMedia(t *testing.T) {
|
||||
if skipAuthTest {
|
||||
t.Skip("Skipping test due to environment variable")
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
var video *twitterscraper.Media
|
||||
video, err = testScraper.UploadMedia("./photo.jpg")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
var photo *twitterscraper.Media
|
||||
photo, err = testScraper.UploadMedia("./video.mp4")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
var tweet *twitterscraper.Tweet
|
||||
tweet, err = testScraper.CreateTweet(twitterscraper.NewTweet{
|
||||
Text: "3 more seconds till i get 🖤",
|
||||
Medias: []*twitterscraper.Media{
|
||||
photo,
|
||||
video,
|
||||
},
|
||||
})
|
||||
|
||||
if tweet != nil {
|
||||
testDeleteTweetId = tweet.ID
|
||||
}
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDeleteTweet(t *testing.T) {
|
||||
if skipAuthTest {
|
||||
t.Skip("Skipping test due to environment variable")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue