Use global test scraper with auth
This commit is contained in:
parent
d34f982b0d
commit
5f380af184
3 changed files with 27 additions and 66 deletions
17
auth_test.go
17
auth_test.go
|
|
@ -1,6 +1,7 @@
|
|||
package twitterscraper_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
|
|
@ -8,11 +9,21 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
username = os.Getenv("TWITTER_USERNAME")
|
||||
password = os.Getenv("TWITTER_PASSWORD")
|
||||
email = os.Getenv("TWITTER_EMAIL")
|
||||
username = os.Getenv("TWITTER_USERNAME")
|
||||
password = os.Getenv("TWITTER_PASSWORD")
|
||||
email = os.Getenv("TWITTER_EMAIL")
|
||||
testScraper = twitterscraper.New()
|
||||
)
|
||||
|
||||
func init() {
|
||||
if username != "" && password != "" {
|
||||
err := testScraper.Login(username, password, email)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("Login() error = %v", err))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestAuth(t *testing.T) {
|
||||
if os.Getenv("SKIP_AUTH_TEST") != "" {
|
||||
t.Skip("Skipping test due to environment variable")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue