forked from emiddleton/gads
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ad_group_criterion_test.go
85 lines (80 loc) · 2.21 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
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(t)
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",
BiddingStrategyConfiguration: &BiddingStrategyConfiguration{
StrategyId: 10,
StrategyType: "MANUAL_CPC",
Scheme: &BiddingScheme{
Type: "TEST",
},
},
},
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",
},
},
},
)
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)
*/
}