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
|
- name: Test
|
||||||
env:
|
env:
|
||||||
|
SKIP_AUTH_TEST: true
|
||||||
TWITTER_USERNAME: ${{ secrets.TWITTER_USERNAME }}
|
TWITTER_USERNAME: ${{ secrets.TWITTER_USERNAME }}
|
||||||
TWITTER_PASSWORD: ${{ secrets.TWITTER_PASSWORD }}
|
TWITTER_PASSWORD: ${{ secrets.TWITTER_PASSWORD }}
|
||||||
TWITTER_EMAIL: ${{ secrets.TWITTER_EMAIL }}
|
TWITTER_EMAIL: ${{ secrets.TWITTER_EMAIL }}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,9 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAuth(t *testing.T) {
|
func TestAuth(t *testing.T) {
|
||||||
|
if os.Getenv("SKIP_AUTH_TEST") != "" {
|
||||||
|
t.Skip("Skipping test due to environment variable")
|
||||||
|
}
|
||||||
scraper := twitterscraper.New()
|
scraper := twitterscraper.New()
|
||||||
if err := scraper.Login(username, password, email); err != nil {
|
if err := scraper.Login(username, password, email); err != nil {
|
||||||
t.Fatalf("Login() error = %v", err)
|
t.Fatalf("Login() error = %v", err)
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package twitterscraper_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
twitterscraper "github.com/n0madic/twitter-scraper"
|
twitterscraper "github.com/n0madic/twitter-scraper"
|
||||||
|
|
@ -17,6 +18,9 @@ func authSearchScraper() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFetchSearchCursor(t *testing.T) {
|
func TestFetchSearchCursor(t *testing.T) {
|
||||||
|
if os.Getenv("SKIP_AUTH_TEST") != "" {
|
||||||
|
t.Skip("Skipping test due to environment variable")
|
||||||
|
}
|
||||||
err := authSearchScraper()
|
err := authSearchScraper()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|
@ -38,6 +42,9 @@ func TestFetchSearchCursor(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetSearchProfiles(t *testing.T) {
|
func TestGetSearchProfiles(t *testing.T) {
|
||||||
|
if os.Getenv("SKIP_AUTH_TEST") != "" {
|
||||||
|
t.Skip("Skipping test due to environment variable")
|
||||||
|
}
|
||||||
count := 0
|
count := 0
|
||||||
maxProfilesNbr := 150
|
maxProfilesNbr := 150
|
||||||
dupcheck := make(map[string]bool)
|
dupcheck := make(map[string]bool)
|
||||||
|
|
@ -68,6 +75,9 @@ func TestGetSearchProfiles(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func TestGetSearchTweets(t *testing.T) {
|
func TestGetSearchTweets(t *testing.T) {
|
||||||
|
if os.Getenv("SKIP_AUTH_TEST") != "" {
|
||||||
|
t.Skip("Skipping test due to environment variable")
|
||||||
|
}
|
||||||
count := 0
|
count := 0
|
||||||
maxTweetsNbr := 150
|
maxTweetsNbr := 150
|
||||||
dupcheck := make(map[string]bool)
|
dupcheck := make(map[string]bool)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue