-
Notifications
You must be signed in to change notification settings - Fork 56
/
campaign_criterion_test.go
41 lines (36 loc) · 1.51 KB
/
campaign_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
package gads
import (
"testing"
// "encoding/xml"
)
func testCampaignCriterionService(t *testing.T) (service *CampaignCriterionService) {
return &CampaignCriterionService{Auth: testAuthSetup(t)}
}
func TestCampaignCriterion(t *testing.T) {
campaign, cleanupCampaign := testCampaign(t)
defer cleanupCampaign()
ccs := testCampaignCriterionService(t)
campaignCriterions, err := ccs.Mutate(
CampaignCriterionOperations{
"ADD": {
CampaignCriterion{CampaignId: campaign.Id, Criterion: AdScheduleCriterion{DayOfWeek: "MONDAY", StartHour: "10", StartMinute: "ZERO", EndHour: "13", EndMinute: "ZERO"}},
CampaignCriterion{CampaignId: campaign.Id, Criterion: Location{Id: 2392}},
NegativeCampaignCriterion{CampaignId: campaign.Id, Criterion: KeywordCriterion{Text: rand_str(10), MatchType: "EXACT"}},
NegativeCampaignCriterion{CampaignId: campaign.Id, Criterion: KeywordCriterion{Text: rand_str(10), MatchType: "EXACT"}},
NegativeCampaignCriterion{CampaignId: campaign.Id, Criterion: KeywordCriterion{Text: rand_str(10), MatchType: "EXACT"}},
NegativeCampaignCriterion{CampaignId: campaign.Id, Criterion: KeywordCriterion{Text: rand_str(10), MatchType: "EXACT"}},
NegativeCampaignCriterion{CampaignId: campaign.Id, Criterion: KeywordCriterion{Text: rand_str(10), MatchType: "EXACT"}},
},
},
)
if err != nil {
t.Fatal(err)
}
//t.Fatalf("%#v\n",campaignCriterions)
defer func() {
_, err = ccs.Mutate(CampaignCriterionOperations{"REMOVE": campaignCriterions})
if err != nil {
t.Error(err)
}
}()
}