Update firebird version

Ditch kiwijar
This commit is contained in:
y a t s
2026-02-06 18:53:31 -05:00
parent f7c8794849
commit 53411f5ae8
4 changed files with 72 additions and 47 deletions

View File

@@ -1,13 +1,10 @@
package libkiwi
import (
"context"
"log"
"net/http"
"os"
"testing"
"github.com/y-a-t-s/kiwijar"
)
const TEST_HOST = "kiwifarms.net"
@@ -19,13 +16,11 @@ func TestGetPage(t *testing.T) {
t.Error(err)
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
log.Println("Getting homepage")
resp, err := kf.GetPage(ctx, kf.domain)
resp, err := kf.GetPage(t.Context(), kf.domain)
if err != nil {
t.Error(err)
return
}
defer resp.Body.Close()
@@ -36,7 +31,7 @@ func TestGetPage(t *testing.T) {
}
}
log.Printf("Response host: %s\n\n", kf.domain)
log.Printf("Cookies: %s\n", kf.Client.Jar.(*kiwijar.KiwiJar).CookieString(kf.domain))
log.Printf("Cookies: %+v\n", resp.Cookies())
}
func TestRefreshSession(t *testing.T) {
@@ -46,24 +41,12 @@ func TestRefreshSession(t *testing.T) {
t.Error(err)
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
log.Println("Refreshing xf_session")
tk, err := kf.RefreshSession(ctx)
tk, err := kf.RefreshSession(t.Context())
if err != nil {
t.Error(err)
return
}
log.Println("New xf_session token: " + tk)
}
func TestCookieString(t *testing.T) {
cookies := os.Getenv("TEST_COOKIES")
kf, err := NewKF(http.Client{}, TEST_HOST, cookies)
if err != nil {
t.Error(err)
}
log.Println("Cookies from jar: " + kf.Client.Jar.(*kiwijar.KiwiJar).CookieString(kf.domain))
}