-
Notifications
You must be signed in to change notification settings - Fork 0
/
fetch_test.go
58 lines (42 loc) · 1005 Bytes
/
fetch_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
package news
import (
"context"
"fmt"
newsapi "newsapi/api"
"testing"
)
var API_KEY = ""
func TestEverything(t *testing.T) {
client := newsapi.NewClient(API_KEY, nil)
response, err := client.Everything(context.Background(), newsapi.EverythingArgs{
QInTitle: "test",
})
if err != nil {
fmt.Printf("err: %v\n", err)
} else {
fmt.Printf("response: %v\n", response)
}
t.Fail()
}
func TestTopHeadlines(t *testing.T) {
client := newsapi.NewClient(API_KEY, nil)
response, err := client.TopHeadlines(context.Background(), newsapi.TopHeadlinesArgs{
Category: newsapi.Category_Entertainment,
})
if err != nil {
fmt.Printf("err: %v\n", err)
} else {
fmt.Printf("response: %v\n", response)
}
t.Fail()
}
func TestSources(t *testing.T) {
client := newsapi.NewClient(API_KEY, nil)
response, err := client.Sources(context.Background(), newsapi.SourcesArgs{})
if err != nil {
fmt.Printf("err: %v\n", err)
} else {
fmt.Printf("response: %v\n", response)
}
t.Fail()
}