Skip to content
This repository was archived by the owner on Nov 30, 2023. It is now read-only.

Commit

Permalink
Skip test with authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Sheiko committed May 20, 2023
1 parent 001c482 commit ec6e8f3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:

- name: Test
env:
SKIP_AUTH_TEST: true
TWITTER_USERNAME: ${{ secrets.TWITTER_USERNAME }}
TWITTER_PASSWORD: ${{ secrets.TWITTER_PASSWORD }}
TWITTER_EMAIL: ${{ secrets.TWITTER_EMAIL }}
Expand Down
3 changes: 3 additions & 0 deletions auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ var (
)

func TestAuth(t *testing.T) {
if os.Getenv("SKIP_AUTH_TEST") != "" {
t.Skip("Skipping test due to environment variable")
}
scraper := twitterscraper.New()
if err := scraper.Login(username, password, email); err != nil {
t.Fatalf("Login() error = %v", err)
Expand Down
10 changes: 10 additions & 0 deletions search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package twitterscraper_test

import (
"context"
"os"
"testing"

twitterscraper "github.com/n0madic/twitter-scraper"
Expand All @@ -17,6 +18,9 @@ func authSearchScraper() error {
}

func TestFetchSearchCursor(t *testing.T) {
if os.Getenv("SKIP_AUTH_TEST") != "" {
t.Skip("Skipping test due to environment variable")
}
err := authSearchScraper()
if err != nil {
t.Fatal(err)
Expand All @@ -38,6 +42,9 @@ func TestFetchSearchCursor(t *testing.T) {
}

func TestGetSearchProfiles(t *testing.T) {
if os.Getenv("SKIP_AUTH_TEST") != "" {
t.Skip("Skipping test due to environment variable")
}
count := 0
maxProfilesNbr := 150
dupcheck := make(map[string]bool)
Expand Down Expand Up @@ -68,6 +75,9 @@ func TestGetSearchProfiles(t *testing.T) {
}
}
func TestGetSearchTweets(t *testing.T) {
if os.Getenv("SKIP_AUTH_TEST") != "" {
t.Skip("Skipping test due to environment variable")
}
count := 0
maxTweetsNbr := 150
dupcheck := make(map[string]bool)
Expand Down

0 comments on commit ec6e8f3

Please sign in to comment.