forked from emiddleton/gads
-
Notifications
You must be signed in to change notification settings - Fork 1
/
conversion_tracker_test.go
57 lines (51 loc) · 1.27 KB
/
conversion_tracker_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
package gads
import "testing"
func testConversionTrackerService(t *testing.T) (service *ConversionTrackerService) {
return &ConversionTrackerService{Auth: testAuthSetup(t)}
}
func TestConversionTracker(t *testing.T) {
cs := testConversionTrackerService(t)
conversionTrackers, err := cs.Mutate(
ConversionTrackerOperations{
"ADD": {
AdWordsConversionTracker{
CommonConversionTracker: &CommonConversionTracker{
Name: "test adword conversion tracker" + rand_str(10),
Status: "ENABLED",
Category: "DEFAULT",
ViewthroughLookbackWindow: 10,
CtcLookbackWindow: 7,
CountingType: "ONE_PER_CLICK",
},
},
},
},
)
if err != nil {
t.Fatal(err)
}
_, _, err = cs.Get(
Selector{
Fields: []string{
"Id",
"Name",
},
Predicates: []Predicate{
{"Id", "EQUALS", []string{conversionTrackers[0].GetID()}},
},
Ordering: []OrderBy{
{"Id", "ASCENDING"},
},
},
)
if err != nil {
t.Fatal(err)
}
defer func(conversionTrackers ConversionTrackers) {
conversionTrackers[0].SetStatus("REMOVED")
_, err = cs.Mutate(ConversionTrackerOperations{"SET": conversionTrackers})
if err != nil {
t.Error(err)
}
}(conversionTrackers)
}