-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgowikidata_test.go
50 lines (38 loc) · 942 Bytes
/
gowikidata_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
package gowikidata
import (
"testing"
)
func TestNewGetEntities(t *testing.T) {
req, _ := NewGetEntities([]string{"Q1"})
req.SetSites([]string{"enwiki", "fawiki"}).SetNormalize(true)
entities, err := req.Get()
if err != nil {
t.Fatalf("entity request faild: %s", err.Error())
}
for _, entity := range *entities {
_, err = entity.NewGetClaims()
}
if err != nil {
t.Fatalf("claim request for entity faild: %s", err.Error())
}
}
func TestGetAvailableBadges(t *testing.T) {
_, err := GetAvailableBadges()
if err != nil {
t.Fatalf("get badges request faild: %s", err.Error())
}
}
func TestNewGetClaims(t *testing.T) {
req, _ := NewGetClaims("Q1", "")
_, err := req.Get()
if err != nil {
t.Fatalf("claim request faild: %s", err.Error())
}
}
func TestNewSearch(t *testing.T) {
req, _ := NewSearch("universe", "en")
_, err := req.Get()
if err != nil {
t.Fatalf("claim request faild: %s", err.Error())
}
}