-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcatalogs_test.go
60 lines (52 loc) · 1.35 KB
/
catalogs_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
package goafterbuy_test
import (
"github.com/jjideenschmiede/goafterbuy"
"testing"
)
// TestCatalogs is to test the catalogs function
func TestCatalogs(t *testing.T) {
// Define variables for request
partnerToken := ""
accountToken := ""
// Define catalogs body
body := goafterbuy.CatalogsBody{
Request: goafterbuy.CatalogsRequest{
AfterbuyGlobal: goafterbuy.AfterbuyGlobal{
PartnerToken: partnerToken,
AccountToken: accountToken,
CallName: "GetShopCatalogs",
ErrorLanguage: "DE",
},
MaxCatalogs: 200,
DataFilter: &goafterbuy.CatalogsRequestDataFilter{
Filter: []goafterbuy.CatalogsRequestFilter{
{
FilterName: "RangeID",
FilterValues: goafterbuy.CatalogsRequestFilterValues{
ValueFrom: 0,
ValueTo: 0,
},
},
{
FilterName: "Level",
FilterValues: goafterbuy.CatalogsRequestFilterValues{
FilterValue: []string{"0", "1", "2"},
},
},
},
},
},
}
// Get catalogs
catalogs, err := goafterbuy.Catalogs(body)
if err != nil {
t.Fatal(err)
}
// Check the results
var results []string
for _, value := range catalogs.Result.Catalogs.Catalog {
results = append(results, value.Name)
}
// Print output
t.Logf("The catalogs were read. There are \"%d\" catalogs. Here you can see the names of the catalogs read out: %v.", len(results), results)
}