2024-09-20 14:41:33 +00:00
|
|
|
|
package bitrixClient
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"fmt"
|
|
|
|
|
"go.uber.org/zap"
|
2024-09-23 09:31:38 +00:00
|
|
|
|
"penahub.gitlab.yandexcloud.net/backend/quiz/bitrix/internal/models"
|
2024-09-20 14:41:33 +00:00
|
|
|
|
"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,
|
|
|
|
|
})
|
|
|
|
|
|
2024-09-23 09:31:38 +00:00
|
|
|
|
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)
|
2024-09-20 14:41:33 +00:00
|
|
|
|
}
|
2024-09-23 09:31:38 +00:00
|
|
|
|
|
|
|
|
|
//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))
|
2024-09-20 14:41:33 +00:00
|
|
|
|
}
|