-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnegative_keyword_test.go
39 lines (31 loc) · 1013 Bytes
/
negative_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
package badsoap
import (
"testing"
)
func TestNegativeKeywords(t *testing.T) {
a.Testing = t
campaignId, adGroupId := testCampaign("Negative Keywords")
defer a.DeleteCampaigns(a.AccountId, []int64{campaignId})
err := a.SetNegativeKeywordsToCampaigns(a.AccountId, map[int64][]string{campaignId: {"test1", "test2"}})
if err != nil {
t.Fatalf(err.Error())
}
campaignIdsNegativeKeywords, err := a.GetNegativeKeywordsByCampaignIds(a.AccountId, []int64{campaignId})
if err != nil {
t.Fatalf(err.Error())
}
if campaignIdsNegativeKeywords == nil {
t.Fatalf("failed to get campaign negative keywords")
}
err = a.SetNegativeKeywordsToAdGroups(campaignId, map[int64][]string{adGroupId: {"test1", "test2"}})
if err != nil {
t.Fatalf(err.Error())
}
adGroupIdsNegativeKeywords, err := a.GetNegativeKeywordsByAdGroupIds(campaignId, []int64{adGroupId})
if err != nil {
t.Fatalf(err.Error())
}
if adGroupIdsNegativeKeywords == nil {
t.Fatalf("failed to get ad group negative keywords")
}
}