41 lines
837 B
Go
41 lines
837 B
Go
|
package privilegewc
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
dal2 "penahub.gitlab.yandexcloud.net/backend/quiz/common.git/dal"
|
||
|
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/model"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestProcessValidMessage(t *testing.T) {
|
||
|
ctx := context.Background()
|
||
|
dal, err := dal2.New(ctx, "host=localhost port=35432 user=squiz password=Redalert2 dbname=squiz sslmode=disable", nil, nil)
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
cfg, err := NewKafkaConsumerWorker(Config{}, nil, dal)
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
|
||
|
msg := []model.PrivilegeMessage{
|
||
|
{
|
||
|
PrivilegeID: "quizUnlimTime",
|
||
|
Amount: 1000,
|
||
|
},
|
||
|
{
|
||
|
PrivilegeID: "quizCnt",
|
||
|
Amount: 1000,
|
||
|
},
|
||
|
{
|
||
|
PrivilegeID: "squizHideBadge",
|
||
|
Amount: 1000,
|
||
|
},
|
||
|
}
|
||
|
|
||
|
err = cfg.processValidMessage(ctx, msg, "65f42bc9059f40a30ab21f68")
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
}
|