fix double applications

This commit is contained in:
2025-06-15 00:28:48 +07:00
parent b6e3fb8596
commit 36aaa49273
5 changed files with 117 additions and 23 deletions
+24
View File
@@ -2,6 +2,7 @@ package tests
import (
"context"
"encoding/base64"
"log"
"testing"
"time"
@@ -12,6 +13,7 @@ import (
"github.com/stretchr/testify/assert"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
)
func getClient() (pb.EveningDetectiveClient, func() error) {
@@ -55,3 +57,25 @@ func getTeams(client pb.EveningDetectiveClient) (*pb.GetTeamsRsp, error) {
req := &pb.GetTeamsReq{}
return client.GetTeams(ctx, req)
}
func addAction(
t *testing.T,
client pb.EveningDetectiveClient,
name string,
password string,
place string,
) {
ctx, cancel := getContext()
defer cancel()
md := metadata.Pairs(
"team-id", base64.StdEncoding.EncodeToString([]byte(name)),
"password", password,
)
ctx = metadata.NewOutgoingContext(ctx, md)
req := &pb.AddActionReq{
Place: place,
}
_, err := client.AddAction(ctx, req)
assert.Nil(t, err, "запрос отправлен успешно")
}