-
Notifications
You must be signed in to change notification settings - Fork 56
/
ad_group_ad_test.go
61 lines (55 loc) · 1.56 KB
/
ad_group_ad_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
package gads
import (
"fmt"
"testing"
)
func testAdGroupAdService(t *testing.T) (service *AdGroupAdService) {
return &AdGroupAdService{Auth: testAuthSetup(t)}
}
func TestAdGroupAd(t *testing.T) {
adGroup, cleanupAdGroup := testAdGroup(t)
defer cleanupAdGroup()
agas := testAdGroupAdService(t)
adGroupAds, err := agas.Mutate(
AdGroupAdOperations{
"ADD": {
NewTextAd(adGroup.Id, "https://classdo.com/en", "classdo.com", "test headline "+rand_word(10), "test line one", "test line two", "PAUSED"),
NewTextAd(adGroup.Id, "https://classdo.com/en", "classdo.com", "test teStTo "+rand_word(10), "test line one", "test line two", "PAUSED"),
NewTextAd(adGroup.Id, "https://classdo.com/en", "classdo.com", "test headline "+rand_word(10), "test line one", "test line two", "PAUSED"),
NewTextAd(adGroup.Id, "https://classdo.com/en", "classdo.com", "test headline "+rand_word(10), "test line one", "test line two", "PAUSED"),
},
},
)
if err != nil {
t.Fatal(err)
}
defer func() {
_, err = agas.Mutate(AdGroupAdOperations{"REMOVE": adGroupAds})
if err != nil {
t.Error(err)
}
}()
adGroupIdStr := fmt.Sprintf("%d", adGroup.Id)
_, _, err = agas.Get(
Selector{
Fields: []string{
"AdGroupId",
"Id",
"Status",
"AdGroupCreativeApprovalStatus",
"AdGroupAdDisapprovalReasons",
"AdGroupAdTrademarkDisapproved",
},
Predicates: []Predicate{
{"AdGroupId", "EQUALS", []string{adGroupIdStr}},
},
Ordering: []OrderBy{
{"AdGroupId", "ASCENDING"},
{"Id", "ASCENDING"},
},
},
)
if err != nil {
t.Fatal(err)
}
}