bitrix/pkg/bitrixClient/bitrix_test.go

50 lines
1.5 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package bitrixClient
import (
"context"
"fmt"
"go.uber.org/zap"
"penahub.gitlab.yandexcloud.net/backend/quiz/bitrix/internal/models"
"penahub.gitlab.yandexcloud.net/backend/quiz/bitrix/internal/workers/limiter"
"testing"
"time"
)
func TestGetListFields(t *testing.T) {
ctx := context.Background()
lim := limiter.NewRateLimiter(ctx, 50, 2*time.Second)
logger := zap.NewNop()
b := NewBitrixClient(BitrixDeps{
Logger: logger,
RedirectionURL: "test",
IntegrationID: "test",
IntegrationSecret: "test",
RateLimiter: lim,
})
arr := []models.FieldsType{models.FieldTypeLead, models.FieldTypeCompany, models.FieldTypeContact, models.FieldTypeDeal}
for _, tipe := range arr {
req := models.AddFields{
EditFormLabel: "ТЕСТОВАЯ СТРОКА ОТ АПИ ГОГОГОГОГОГОГОГОГГО",
ListColumnLabel: "ТЕСТОВАЯ СТРОКА ОТ АПИ ГОГОГОГОГОГОГОГОГГО",
UserTypeID: "string",
Settings: map[string]interface{}{
"DEFAULT_VALUE": "GOGOGOGOGOGOGO!",
}}
req.GenFieldName()
result, err := b.AddFields(req, tipe, "6142f1660000071b00717f92000000010000075c982e18665711d1c3e5749d1dda6679", "b24-ld76ub.bitrix24.ru")
if err != nil {
fmt.Println(err)
}
fmt.Println(result)
}
//result, err := b.GetListFields(models.FieldTypeLead, "3434f1660000071b00717f920000000100000748ae9cd373ba39739040870e7dc9fb99", "b24-ld76ub.bitrix24.ru")
//if err != nil {
// fmt.Println(err)
//}
//r, _ := json.Marshal(result)
//fmt.Println(string(r))
}