offline-twitter/scraper/authentication_test.go

31 lines
683 B
Go
Raw Normal View History

2022-12-10 14:33:27 -05:00
package scraper_test
import (
. "offline_twitter/scraper"
2022-12-10 14:33:27 -05:00
"testing"
2022-12-20 19:05:08 -05:00
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
2022-12-10 14:33:27 -05:00
)
func TestAuthentication(t *testing.T) {
2022-12-20 19:05:08 -05:00
assert := assert.New(t)
require := require.New(t)
2022-12-20 19:05:08 -05:00
2022-12-10 14:33:27 -05:00
username := "offline_twatter"
password := "S1pKIW#eRT016iA@OFcK"
api := NewGuestSession()
2022-12-10 14:33:27 -05:00
api.LogIn(username, password)
2022-12-20 19:05:08 -05:00
assert.True(api.IsAuthenticated)
assert.NotEqual(api.CSRFToken, "")
assert.Equal(api.UserHandle, UserHandle("Offline_Twatter"))
2022-12-20 19:05:08 -05:00
2022-12-22 23:12:11 -05:00
response, err := api.GetLikesFor(1458284524761075714, "")
require.NoError(err)
trove, err := response.ToTweetTrove()
require.NoError(err)
assert.True(len(trove.Tweets) > 0)
2022-12-10 14:33:27 -05:00
}