-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkeyword_test.go
96 lines (81 loc) · 2.03 KB
/
keyword_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 badsoap
import (
"testing"
)
func TestKeywords(t *testing.T) {
a.Testing = t
campaignId, adGroupId := testCampaign("Keywords")
defer a.DeleteCampaigns(a.AccountId, []int64{campaignId})
keywordIds, err := a.AddKeywords(adGroupId, []Keyword{
{
Text: "testing",
ExactMatchBid: &AmountType{0.5},
NegativeKeywords: []string{},
Status: "Paused",
},
})
if err != nil {
t.Fatalf(err.Error())
}
if keywordIds == nil {
t.Fatalf("failed to add keywords")
}
destinationUrls, err := a.GetDestinationUrlByKeywordIds(adGroupId, keywordIds)
if err != nil {
t.Fatalf(err.Error())
}
if destinationUrls == nil {
t.Fatalf("failed to get destination urls from keyword ids")
}
editorialReasons, err := a.GetKeywordEditorialReasonsByIds(a.AccountId, keywordIds)
if err != nil {
t.Fatalf(err.Error())
}
if editorialReasons == nil {
t.Fatalf("failed to get editorial resions from keyword ids")
}
keywords, err := a.GetKeywordsByAdGroupId(adGroupId)
if err != nil {
t.Fatalf(err.Error())
}
if keywords == nil {
t.Fatalf("failed to get keywords from ad group ids")
}
keywords, err = a.GetKeywordsByEditorialStatus(adGroupId, "Active")
if err != nil {
t.Fatalf(err.Error())
}
if keywords == nil {
t.Fatalf("failed to get keywords by editorial reasion")
}
keywords, err = a.GetKeywordsByIds(adGroupId, keywordIds)
if err != nil {
t.Fatalf(err.Error())
}
if keywords == nil {
t.Fatalf("failed to get keywords by their ids")
}
err = a.ResumeKeywords(adGroupId, keywordIds)
if err != nil {
t.Fatalf(err.Error())
}
err = a.PauseKeywords(adGroupId, keywordIds)
if err != nil {
t.Fatalf(err.Error())
}
err = a.SetDestinationUrlToKeywords(adGroupId, map[int64]string{
keywordIds[0]: "http://example.com/",
})
if err != nil {
t.Fatalf(err.Error())
}
keywords[0].ExactMatchBid = &AmountType{0.9}
err = a.UpdateKeywords(adGroupId, keywords)
if err != nil {
t.Fatalf(err.Error())
}
err = a.DeleteKeywords(adGroupId, keywordIds)
if err != nil {
t.Fatalf(err.Error())
}
}