mirror of
https://gitgud.io/yats/libkiwi.git
synced 2026-06-23 03:25:22 -04:00
Refactoring n shit
This commit is contained in:
+2
-27
@@ -21,7 +21,7 @@ func TestGetPage(t *testing.T) {
|
||||
ctx := t.Context()
|
||||
|
||||
t.Log("Getting homepage\n")
|
||||
resp, err := kf.GetPage(ctx, kf.domain)
|
||||
resp, err := kf.Get(ctx, kf.domain)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
@@ -58,7 +58,7 @@ func TestGetPost(t *testing.T) {
|
||||
}
|
||||
|
||||
func newTestKF() (*KF, error) {
|
||||
host := os.Getenv("KF_HOST")
|
||||
host := os.Getenv("TEST_HOST")
|
||||
if host == "" {
|
||||
host = _TEST_HOST
|
||||
}
|
||||
@@ -85,28 +85,3 @@ func newTestKF() (*KF, error) {
|
||||
|
||||
return NewKF(hc, u)
|
||||
}
|
||||
|
||||
func TestLogin(t *testing.T) {
|
||||
user, pass := os.Getenv("TEST_USER"), os.Getenv("TEST_PASS")
|
||||
if user == "" || pass == "" {
|
||||
t.Log("TEST_USER and/or TEST_PASS empty. Skipping.\n")
|
||||
return
|
||||
}
|
||||
|
||||
kf, err := newTestKF()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
ctx := t.Context()
|
||||
|
||||
resp, err := kf.Login(ctx, user, pass)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
t.Logf("Login response: %+v\n", resp)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user