-
Notifications
You must be signed in to change notification settings - Fork 56
/
ad_group_criterion_test.go
96 lines (91 loc) · 2.64 KB
/
ad_group_criterion_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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
package gads
import (
"testing"
// "encoding/xml"
)
func testAdGroupCriterionService(t *testing.T) (service *AdGroupCriterionService) {
return &AdGroupCriterionService{Auth: testAuthSetup(t)}
}
func TestAdGroupCriterion(t *testing.T) {
adGroup, cleanupAdGroup := testAdGroup(nil)
defer cleanupAdGroup()
agcs := testAdGroupCriterionService(t)
adGroupCriterions, err := agcs.Mutate(
AdGroupCriterionOperations{
"ADD": {
/*
NegativeAdGroupCriterion{
AdGroupId: adGroup.Id,
Criterion: AgeRangeCriterion{AgeRangeType:"AGE_RANGE_25_34"},
},
NegativeAdGroupCriterion{
AdGroupId: adGroup.Id,
Criterion: GenderCriterion{},
},
NewBiddableAdGroupCriterion{
AdGroupId: adGroup.Id,
Criterion: MobileAppCategoryCriterion{
60000,"My Google Play Android Apps"
}
},
*/
BiddableAdGroupCriterion{
AdGroupId: adGroup.Id,
Criterion: KeywordCriterion{Text: "test1", MatchType: "EXACT"},
UserStatus: "PAUSED",
},
BiddableAdGroupCriterion{
AdGroupId: adGroup.Id,
Criterion: KeywordCriterion{Text: "test2", MatchType: "PHRASE"},
UserStatus: "PAUSED",
},
BiddableAdGroupCriterion{
AdGroupId: adGroup.Id,
Criterion: KeywordCriterion{Text: "test3", MatchType: "BROAD"},
UserStatus: "PAUSED",
},
NegativeAdGroupCriterion{
AdGroupId: adGroup.Id,
Criterion: KeywordCriterion{Text: "test4", MatchType: "BROAD"},
},
BiddableAdGroupCriterion{
AdGroupId: adGroup.Id,
Criterion: PlacementCriterion{Url: "https://classdo.com"},
UserStatus: "PAUSED",
},
// NewBiddableAdGroupCriterion(adGroup.Id, NewUserInterestCriterion()),
// NewBiddableAdGroupCriterion(adGroup.Id, NewUserListCriterion()),
// NewBiddableAdGroupCriterion(adGroup.Id, NewVerticalCriterion(0, 0, []string{"Pets & Anamals","Pets","Dogs"})),
BiddableAdGroupCriterion{
AdGroupId: adGroup.Id,
Criterion: WebpageCriterion{
Parameter: WebpageParameter{
CriterionName: "test criterion",
Conditions: []WebpageCondition{
WebpageCondition{
Operand: "URL",
Argument: "example.com",
},
},
},
},
UserStatus: "PAUSED",
},
},
},
)
if err != nil {
t.Fatal(err)
}
t.Logf("%#v", adGroupCriterions)
defer func() {
_, err = agcs.Mutate(AdGroupCriterionOperations{"REMOVE": adGroupCriterions})
if err != nil {
t.Error(err)
}
}()
/*
reqBody, err := xml.MarshalIndent(adGroupCriterions," ", " ")
t.Fatalf("%s\n",reqBody)
*/
}