You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
1.7 KiB
74 lines
1.7 KiB
package stat |
|
|
|
import ( |
|
"context" |
|
"testing" |
|
|
|
"github.com/smartystreets/goconvey/convey" |
|
) |
|
|
|
func TestStatipBanKey(t *testing.T) { |
|
convey.Convey("ipBanKey", t, func(convCtx convey.C) { |
|
var ( |
|
id = int64(0) |
|
ip = "" |
|
) |
|
convCtx.Convey("When everything goes positive", func(convCtx convey.C) { |
|
key := ipBanKey(id, ip) |
|
convCtx.Convey("Then key should not be nil.", func(convCtx convey.C) { |
|
convCtx.So(key, convey.ShouldNotBeNil) |
|
}) |
|
}) |
|
}) |
|
} |
|
|
|
func TestStatbuvidBanKey(t *testing.T) { |
|
convey.Convey("buvidBanKey", t, func(convCtx convey.C) { |
|
var ( |
|
id = int64(0) |
|
mid = int64(0) |
|
ip = "" |
|
buvid = "" |
|
) |
|
convCtx.Convey("When everything goes positive", func(convCtx convey.C) { |
|
key := buvidBanKey(id, mid, ip, buvid) |
|
convCtx.Convey("Then key should not be nil.", func(convCtx convey.C) { |
|
convCtx.So(key, convey.ShouldNotBeNil) |
|
}) |
|
}) |
|
}) |
|
} |
|
|
|
func TestStatIPBan(t *testing.T) { |
|
convey.Convey("IPBan", t, func(convCtx convey.C) { |
|
var ( |
|
c = context.Background() |
|
id = int64(0) |
|
ip = "" |
|
) |
|
convCtx.Convey("When everything goes positive", func(convCtx convey.C) { |
|
ban := d.IPBan(c, id, ip) |
|
convCtx.Convey("Then ban should not be nil.", func(convCtx convey.C) { |
|
convCtx.So(ban, convey.ShouldNotBeNil) |
|
}) |
|
}) |
|
}) |
|
} |
|
|
|
func TestStatBuvidBan(t *testing.T) { |
|
convey.Convey("BuvidBan", t, func(convCtx convey.C) { |
|
var ( |
|
c = context.Background() |
|
id = int64(0) |
|
mid = int64(0) |
|
buvid = "" |
|
ip = "" |
|
) |
|
convCtx.Convey("When everything goes positive", func(convCtx convey.C) { |
|
ban := d.BuvidBan(c, id, mid, ip, buvid) |
|
convCtx.Convey("Then ban should not be nil.", func(convCtx convey.C) { |
|
convCtx.So(ban, convey.ShouldNotBeNil) |
|
}) |
|
}) |
|
}) |
|
}
|
|
|