37 lines
1.3 KiB
Go
37 lines
1.3 KiB
Go
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)
|
|
}
|
|
}
|
|
}
|