forked from emiddleton/gads
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcampaign_extension_setting_test.go
More file actions
73 lines (67 loc) · 1.46 KB
/
campaign_extension_setting_test.go
File metadata and controls
73 lines (67 loc) · 1.46 KB
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
package gads
import (
"strconv"
"testing"
)
func testCampaignExtensionService(t *testing.T) (service *CampaignExtensionSettingService) {
return &CampaignExtensionSettingService{Auth: testAuthSetup(t)}
}
func TestCampaignExtension(t *testing.T) {
campaign, cleanupCampaign := testCampaign(t)
defer cleanupCampaign()
ces := testCampaignExtensionService(t)
campaignExtensionSettings, err := ces.Mutate(
CampaignExtensionSettingOperations{
"ADD": {
CampaignExtensionSetting{
CampaignID: campaign.Id,
ExtensionType: "SITELINK",
ExtensionSetting: &ExtensionSetting{
Extensions: []ExtensionFeedItem{
SitelinkFeedItem{
CommonExtensionFeedItem: &CommonExtensionFeedItem{
Type: "SitelinkFeedItem",
},
Text: "hello",
FinalUrls: &UrlList{Urls: []string{"http://example.com"}},
},
},
PlateformRestrictions: "NONE",
},
},
},
},
)
if err != nil {
t.Fatal(err)
}
defer func() {
_, err = ces.Mutate(CampaignExtensionSettingOperations{"REMOVE": campaignExtensionSettings})
if err != nil {
t.Error(err)
}
}()
_, _, err = ces.Get(
Selector{
Fields: []string{
"Extensions",
},
Predicates: []Predicate{
{
"ExtensionType",
"EQUALS",
[]string{"SITELINK"},
},
{
"CampaignId",
"EQUALS",
[]string{strconv.FormatInt(campaign.Id, 10)},
},
},
Ordering: []OrderBy{},
},
)
if err != nil {
t.Fatal(err)
}
}