change type on active field

This commit is contained in:
Ruslan Efanov 2022-12-06 22:27:56 +03:00
parent a29e2419ff
commit 50e25d61bc
2 changed files with 16 additions and 7 deletions

View File

@ -5118,7 +5118,7 @@ func TestClient_IntegrationModule(t *testing.T) {
integrationModule := IntegrationModule{ integrationModule := IntegrationModule{
Code: code, Code: code,
IntegrationCode: code, IntegrationCode: code,
Active: false, Active: new(bool),
Name: fmt.Sprintf("Integration module %s", name), Name: fmt.Sprintf("Integration module %s", name),
AccountURL: fmt.Sprintf("http://example.com/%s/account", name), AccountURL: fmt.Sprintf("http://example.com/%s/account", name),
BaseURL: fmt.Sprintf("http://example.com/%s", name), BaseURL: fmt.Sprintf("http://example.com/%s", name),
@ -5126,10 +5126,13 @@ func TestClient_IntegrationModule(t *testing.T) {
Logo: "https://cdn.worldvectorlogo.com/logos/github-icon.svg", Logo: "https://cdn.worldvectorlogo.com/logos/github-icon.svg",
} }
jr, _ := json.Marshal(&integrationModule) jsonData := fmt.Sprintf(
`{"code":"%s","integrationCode":"%s","active":false,"name":"%s","logo":"%s","clientId":"%s","baseUrl":"%s","accountUrl":"%s"}`,
code, code, integrationModule.Name, integrationModule.Logo, integrationModule.ClientID, integrationModule.BaseURL, integrationModule.AccountURL,
)
pr := url.Values{ pr := url.Values{
"integrationModule": {string(jr[:])}, "integrationModule": {jsonData},
} }
gock.New(crmURL). gock.New(crmURL).
@ -5179,9 +5182,12 @@ func TestClient_IntegrationModule_Fail(t *testing.T) {
defer gock.Off() defer gock.Off()
active := new(bool)
*active = true
integrationModule := IntegrationModule{ integrationModule := IntegrationModule{
IntegrationCode: code, IntegrationCode: code,
Active: false, Active: active,
Name: fmt.Sprintf("Integration module %s", name), Name: fmt.Sprintf("Integration module %s", name),
AccountURL: fmt.Sprintf("http://example.com/%s/account", name), AccountURL: fmt.Sprintf("http://example.com/%s/account", name),
BaseURL: fmt.Sprintf("http://example.com/%s", name), BaseURL: fmt.Sprintf("http://example.com/%s", name),
@ -5189,10 +5195,13 @@ func TestClient_IntegrationModule_Fail(t *testing.T) {
Logo: "https://cdn.worldvectorlogo.com/logos/github-icon.svg", Logo: "https://cdn.worldvectorlogo.com/logos/github-icon.svg",
} }
jr, _ := json.Marshal(&integrationModule) jsonData := fmt.Sprintf(
`{"integrationCode":"%s","active":true,"name":"%s","logo":"%s","clientId":"%s","baseUrl":"%s","accountUrl":"%s"}`,
code, integrationModule.Name, integrationModule.Logo, integrationModule.ClientID, integrationModule.BaseURL, integrationModule.AccountURL,
)
pr := url.Values{ pr := url.Values{
"integrationModule": {string(jr[:])}, "integrationModule": {jsonData},
} }
gock.New(crmURL). gock.New(crmURL).

View File

@ -975,7 +975,7 @@ type DeliveryShipment struct {
type IntegrationModule struct { type IntegrationModule struct {
Code string `json:"code,omitempty"` Code string `json:"code,omitempty"`
IntegrationCode string `json:"integrationCode,omitempty"` IntegrationCode string `json:"integrationCode,omitempty"`
Active bool `json:"active"` Active *bool `json:"active,omitempty"`
Freeze bool `json:"freeze,omitempty"` Freeze bool `json:"freeze,omitempty"`
Native bool `json:"native,omitempty"` Native bool `json:"native,omitempty"`
Name string `json:"name,omitempty"` Name string `json:"name,omitempty"`