skip tests that requires auth

This commit is contained in:
Valentine 2024-03-08 19:23:39 +03:00
parent 02625a94bd
commit b29bf22ac1
6 changed files with 21 additions and 9 deletions

View file

@ -6,6 +6,9 @@ import (
) )
func TestGetBookmarks(t *testing.T) { func TestGetBookmarks(t *testing.T) {
if skipAuthTest {
t.Skip("Skipping test due to environment variable")
}
count := 0 count := 0
maxTweetsNbr := 40 maxTweetsNbr := 40
dupcheck := make(map[string]bool) dupcheck := make(map[string]bool)

View file

@ -5,6 +5,9 @@ import (
) )
func TestFetchFollowing(t *testing.T) { func TestFetchFollowing(t *testing.T) {
if skipAuthTest {
t.Skip("Skipping test due to environment variable")
}
users, _, err := testScraper.FetchFollowing("Support", 20, "") users, _, err := testScraper.FetchFollowing("Support", 20, "")
if err != nil { if err != nil {
t.Error(err) t.Error(err)
@ -15,6 +18,9 @@ func TestFetchFollowing(t *testing.T) {
} }
func TestFetchFollowers(t *testing.T) { func TestFetchFollowers(t *testing.T) {
if skipAuthTest {
t.Skip("Skipping test due to environment variable")
}
users, _, err := testScraper.FetchFollowers("Support", 20, "") users, _, err := testScraper.FetchFollowers("Support", 20, "")
if err != nil { if err != nil {
t.Error(err) t.Error(err)

View file

@ -6,6 +6,9 @@ import (
) )
func TestGetMedias(t *testing.T) { func TestGetMedias(t *testing.T) {
if skipAuthTest {
t.Skip("Skipping test due to environment variable")
}
count := 0 count := 0
maxTweetsNbr := 20 maxTweetsNbr := 20
dupcheck := make(map[string]bool) dupcheck := make(map[string]bool)

View file

@ -112,7 +112,7 @@ func TestGetProfilePrivate(t *testing.T) {
} }
func TestGetProfileErrorSuspended(t *testing.T) { func TestGetProfileErrorSuspended(t *testing.T) {
_, err := testScraper.GetProfile("123") _, err := testScraper.GetProfile("2")
if err == nil { if err == nil {
t.Error("Expected Error, got success") t.Error("Expected Error, got success")
} else { } else {

View file

@ -8,6 +8,9 @@ import (
) )
func TestFetchScheduledTweets(t *testing.T) { func TestFetchScheduledTweets(t *testing.T) {
if skipAuthTest {
t.Skip("Skipping test due to environment variable")
}
scheduled, err := testScraper.FetchScheduledTweets() scheduled, err := testScraper.FetchScheduledTweets()
if err != nil { if err != nil {
t.Error(err) t.Error(err)
@ -20,6 +23,9 @@ func TestFetchScheduledTweets(t *testing.T) {
var id string var id string
func TestCreateScheduledTweets(t *testing.T) { func TestCreateScheduledTweets(t *testing.T) {
if skipAuthTest {
t.Skip("Skipping test due to environment variable")
}
var err error var err error
id, err = testScraper.CreateScheduledTweet("new tweet", time.Now().Add(time.Hour*24*31)) id, err = testScraper.CreateScheduledTweet("new tweet", time.Now().Add(time.Hour*24*31))
if err != nil { if err != nil {

View file

@ -133,9 +133,6 @@ func TestGetTweetWithMultiplePhotos(t *testing.T) {
} }
func TestGetTweetWithGIF(t *testing.T) { func TestGetTweetWithGIF(t *testing.T) {
if skipAuthTest {
t.Skip("Skipping test due to environment variable")
}
expectedTweet := twitterscraper.Tweet{ expectedTweet := twitterscraper.Tweet{
ConversationID: "1517535384833605632", ConversationID: "1517535384833605632",
GIFs: []twitterscraper.GIF{ GIFs: []twitterscraper.GIF{
@ -158,9 +155,6 @@ func TestGetTweetWithGIF(t *testing.T) {
} }
func TestGetTweetWithPhotoAndGIF(t *testing.T) { func TestGetTweetWithPhotoAndGIF(t *testing.T) {
if skipAuthTest {
t.Skip("Skipping test due to environment variable")
}
expectedTweet := twitterscraper.Tweet{ expectedTweet := twitterscraper.Tweet{
ConversationID: "1583186305722507265", ConversationID: "1583186305722507265",
GIFs: []twitterscraper.GIF{ GIFs: []twitterscraper.GIF{
@ -237,8 +231,8 @@ func TestQuotedAndReply(t *testing.T) {
if !tweet.IsReply { if !tweet.IsReply {
t.Error("IsReply must be True") t.Error("IsReply must be True")
} }
if diff := cmp.Diff(sample, tweet.InReplyToStatus, cmpOptions...); diff != "" { if tweet.ConversationID != sample.ConversationID {
t.Error("Resulting reply does not match the sample", diff) t.Error("Resulting reply does not match the required ConversationID")
} }
} }