Improve logout

drop session in Twitter
This commit is contained in:
Alexander Sheiko 2023-05-10 22:24:32 +03:00
parent e86c2fa4ce
commit 90f9a71721
3 changed files with 28 additions and 14 deletions

View file

@ -22,13 +22,15 @@ func TestAuth(t *testing.T) {
t.Fatalf("Expected IsLoggedIn() = true")
}
cookies := scraper.GetCookies()
scraper.Logout()
if scraper.IsLoggedIn() {
t.Error("Expected IsLoggedIn() = false")
}
scraper2 := twitterscraper.New()
scraper2.SetCookies(cookies)
if !scraper2.IsLoggedIn() {
t.Error("Expected restored IsLoggedIn() = true")
}
if err := scraper.Logout(); err != nil {
t.Errorf("Logout() error = %v", err)
}
if scraper.IsLoggedIn() {
t.Error("Expected IsLoggedIn() = false")
}
}