123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228 |
- package black
- import (
- "context"
- "reflect"
- "testing"
- "go-common/app/interface/main/app-feed/conf"
- "go-common/library/cache/redis"
- httpx "go-common/library/net/http/blademaster"
- . "github.com/smartystreets/goconvey/convey"
- )
- func TestNew(t *testing.T) {
- type args struct {
- c *conf.Config
- }
- tests := []struct {
- name string
- args args
- wantD *Dao
- }{
- // TODO: Add test cases.
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- if gotD := New(tt.args.c); !reflect.DeepEqual(gotD, tt.wantD) {
- t.Errorf("New() = %v, want %v", gotD, tt.wantD)
- }
- })
- Convey(tt.name, func(t *testing.T) {
- gotD := New(tt.args.c)
- So(gotD, ShouldEqual, tt.wantD)
- })
- }
- }
- func TestDao_Ping(t *testing.T) {
- type fields struct {
- clientAsyn *httpx.Client
- redis *redis.Pool
- expireRds int32
- aCh chan func()
- }
- type args struct {
- c context.Context
- }
- tests := []struct {
- name string
- fields fields
- args args
- wantErr bool
- }{
- // TODO: Add test cases.
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- d := &Dao{
- clientAsyn: tt.fields.clientAsyn,
- redis: tt.fields.redis,
- expireRds: tt.fields.expireRds,
- aCh: tt.fields.aCh,
- }
- if err := d.Ping(tt.args.c); (err != nil) != tt.wantErr {
- t.Errorf("Dao.Ping() error = %v, wantErr %v", err, tt.wantErr)
- }
- })
- }
- }
- func TestDao_AddBlacklist(t *testing.T) {
- type fields struct {
- clientAsyn *httpx.Client
- redis *redis.Pool
- expireRds int32
- aCh chan func()
- }
- type args struct {
- mid int64
- aid int64
- }
- tests := []struct {
- name string
- fields fields
- args args
- }{
- // TODO: Add test cases.
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- d := &Dao{
- clientAsyn: tt.fields.clientAsyn,
- redis: tt.fields.redis,
- expireRds: tt.fields.expireRds,
- aCh: tt.fields.aCh,
- }
- d.AddBlacklist(tt.args.mid, tt.args.aid)
- })
- }
- }
- func TestDao_DelBlacklist(t *testing.T) {
- type fields struct {
- clientAsyn *httpx.Client
- redis *redis.Pool
- expireRds int32
- aCh chan func()
- }
- type args struct {
- mid int64
- aid int64
- }
- tests := []struct {
- name string
- fields fields
- args args
- }{
- // TODO: Add test cases.
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- d := &Dao{
- clientAsyn: tt.fields.clientAsyn,
- redis: tt.fields.redis,
- expireRds: tt.fields.expireRds,
- aCh: tt.fields.aCh,
- }
- d.DelBlacklist(tt.args.mid, tt.args.aid)
- })
- }
- }
- func TestDao_BlackList(t *testing.T) {
- type fields struct {
- clientAsyn *httpx.Client
- redis *redis.Pool
- expireRds int32
- aCh chan func()
- }
- type args struct {
- c context.Context
- mid int64
- }
- tests := []struct {
- name string
- fields fields
- args args
- wantAidm map[int64]struct{}
- wantErr bool
- }{
- // TODO: Add test cases.
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- d := &Dao{
- clientAsyn: tt.fields.clientAsyn,
- redis: tt.fields.redis,
- expireRds: tt.fields.expireRds,
- aCh: tt.fields.aCh,
- }
- gotAidm, err := d.BlackList(tt.args.c, tt.args.mid)
- if (err != nil) != tt.wantErr {
- t.Errorf("Dao.BlackList() error = %v, wantErr %v", err, tt.wantErr)
- return
- }
- if !reflect.DeepEqual(gotAidm, tt.wantAidm) {
- t.Errorf("Dao.BlackList() = %v, want %v", gotAidm, tt.wantAidm)
- }
- })
- }
- }
- func TestDao_addCache(t *testing.T) {
- type fields struct {
- clientAsyn *httpx.Client
- redis *redis.Pool
- expireRds int32
- aCh chan func()
- }
- type args struct {
- i func()
- }
- tests := []struct {
- name string
- fields fields
- args args
- }{
- // TODO: Add test cases.
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- d := &Dao{
- clientAsyn: tt.fields.clientAsyn,
- redis: tt.fields.redis,
- expireRds: tt.fields.expireRds,
- aCh: tt.fields.aCh,
- }
- d.addCache(tt.args.i)
- })
- }
- }
- func TestDao_cacheproc(t *testing.T) {
- type fields struct {
- clientAsyn *httpx.Client
- redis *redis.Pool
- expireRds int32
- aCh chan func()
- }
- tests := []struct {
- name string
- fields fields
- }{
- // TODO: Add test cases.
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- d := &Dao{
- clientAsyn: tt.fields.clientAsyn,
- redis: tt.fields.redis,
- expireRds: tt.fields.expireRds,
- aCh: tt.fields.aCh,
- }
- d.cacheproc()
- })
- }
- }
|