chore: 并入 iotlcm-admin-svr 历史到 admin-svr/(原提交 49818c6)
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1"
|
||||
|
||||
"github.com/gogf/gf/v2/util/gmeta"
|
||||
)
|
||||
|
||||
// 右上角未读消息提醒依赖这三个接口,路径、方法或权限码被改动都会导致提醒静默失效。
|
||||
// 权限码必须是 cpc:current:user:没有菜单权限的登录用户也要能获取自己的未读消息。
|
||||
func TestMessageLogUnreadNotificationDeclarations(t *testing.T) {
|
||||
cases := []struct {
|
||||
name string
|
||||
request interface{}
|
||||
path string
|
||||
method string
|
||||
permission string
|
||||
}{
|
||||
{"unreadList", v1.TMessageLogUnreadListReq{}, "/tMessageLog/unreadList", "get", "cpc:current:user"},
|
||||
{"read", v1.TMessageLogReadReq{}, "/tMessageLog/read", "post", "cpc:current:user"},
|
||||
{"readAll", v1.TMessageLogReadAllReq{}, "/tMessageLog/readAll", "post", "cpc:current:user"},
|
||||
}
|
||||
for _, check := range cases {
|
||||
if got := gmeta.Get(check.request, "path").String(); got != check.path {
|
||||
t.Errorf("%s path = %q, want %q", check.name, got, check.path)
|
||||
}
|
||||
if got := gmeta.Get(check.request, "method").String(); got != check.method {
|
||||
t.Errorf("%s method = %q, want %q", check.name, got, check.method)
|
||||
}
|
||||
if got := gmeta.Get(check.request, "x-check-permission").String(); got != check.permission {
|
||||
t.Errorf("%s permission = %q, want %q", check.name, got, check.permission)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user