]> 127.0.0.1 Git - bili_danmu/.git/commitdiff
Add 添加对api的test
authorqydysky <qydysky@foxmail.com>
Thu, 27 Apr 2023 07:07:37 +0000 (07:07 +0000)
committerGitHub <noreply@github.com>
Thu, 27 Apr 2023 07:07:37 +0000 (07:07 +0000)
F/api.go
F/api_test.go
demo/config/config_K_v.json

index 920c89ab117c3ce2a74f11ab9b8a82724433e142..e79be8a1b0b449a8743b5f6c16ad45cb02aa18be 100644 (file)
--- a/F/api.go
+++ b/F/api.go
@@ -1277,7 +1277,7 @@ func (c *GetFunc) Get_cookie() (missKey []string) {
        }
 
        if v, ok := c.K_v.LoadV(`扫码登录`).(bool); !ok || !v {
-               apilog.L(`W: `, `配置文件已禁止扫码登录`)
+               apilog.L(`W: `, `配置文件已禁止扫码登录,如需登录,修改配置文件"扫码登录"为true`)
                return
        }
 
index 24b236f0805b56629a62935d2d666294c5fe9709..f359dcf6ade02b83213473dfce1ad51bba39e6e2 100644 (file)
@@ -1,6 +1,24 @@
 package F
 
-import "testing"
+import (
+       "testing"
+
+       c "github.com/qydysky/bili_danmu/CV"
+)
+
+func TestCookie(t *testing.T) {
+       //获取cookie
+       Get(c.C).Get(`Cookie`)
+       //获取LIVE_BUVID
+       Get(c.C).Get(`LIVE_BUVID`)
+
+       if _, ok := c.C.Cookie.Load("LIVE_BUVID"); !ok {
+               t.Fatal()
+       }
+       if _, ok := c.C.Cookie.Load("buvid3"); !ok {
+               t.Fatal()
+       }
+}
 
 func Test_getWridWts(t *testing.T) {
        w_rid, _ := new(GetFunc).getWridWts(
@@ -13,3 +31,9 @@ func Test_getWridWts(t *testing.T) {
                t.Fatal()
        }
 }
+
+func Test_SearchUP(t *testing.T) {
+       if v := Get(c.C).SearchUP("qydysky"); len(v) == 0 && v[0].Roomid != 394988 {
+               t.Fatal()
+       }
+}
index ebef581f64fd98b1f419166be0a0e61119f8514d..a824844c495b2080f0daf23b3ec2b1056aebcfc0 100644 (file)
     "cookie加密公钥": "public.pem",
     "cookie解密私钥": "private.pem",
     "扫码登录-help": "当扫码登陆设置为true时,每次启动会检查,若失败则会要求登录",
-    "扫码登录": true,
+    "扫码登录": false,
     "扫码登录路径": "/qr/",
     "扫码登录自动打开标签页": false,
     "网络中断不退出": true,