Skip test with authentication
This commit is contained in:
parent
0c2489c695
commit
10887ac302
3 changed files with 14 additions and 0 deletions
1
.github/workflows/go.yml
vendored
1
.github/workflows/go.yml
vendored
|
|
@ -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 }}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package twitterscraper_test
|
|||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
twitterscraper "github.com/n0madic/twitter-scraper"
|
||||
|
|
@ -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)
|
||||
|
|
@ -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)
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue