-
Notifications
You must be signed in to change notification settings - Fork 6
/
deals_test.go
65 lines (59 loc) · 1.07 KB
/
deals_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package hubspot
import (
"os"
"strconv"
"testing"
)
func TestDeals(t *testing.T) {
tvid, err := strconv.Atoi(os.Getenv("HUBSPOT_TEST_VID"))
if err != nil {
t.Fatal(err)
}
data := DealsRequest{
Associations: Associations{
AssociatedVids: []int{tvid},
},
Properties: []Property{
Property{
Name: "dealname",
Value: "Test Deal Activity",
},
Property{
Name: "brigade_country",
Value: "Honduras",
},
Property{
Name: "brigade_name",
Value: "Test Brigade",
},
Property{
Name: "brigade_leader_name",
Value: "Test Brigade Leader",
},
},
}
c := NewClient(NewClientConfig())
r, err := c.Deals().Create(data)
if err != nil {
t.Error(err)
}
if r.ErrorResponse.Status == "error" {
t.Error(r.ErrorResponse.Message)
}
if r.DealID != 0 {
r, err = c.Deals().Get(r.DealID)
if err != nil {
t.Error(err)
}
if r.ErrorResponse.Status == "error" {
t.Error(r.ErrorResponse.Message)
}
}
if r.DealID != 0 {
err = c.Deals().Delete(r.DealID)
if err != nil {
t.Error(err)
}
}
//t.Logf("%+v", r)
}