/
twitter_test.go
49 lines (42 loc) · 911 Bytes
/
twitter_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
// Copyright (c) 2015 Andrea Masi. All rights reserved.
// Use of this source code is governed by MIT license
// which that can be found in the LICENSE.txt file.
package main
import (
"fmt"
"os"
"testing"
"github.com/eraclitux/cfgp"
)
func setup(t *testing.T) {
conf = myConf{}
err := cfgp.Parse(&conf)
if err != nil {
t.Fatal("unable to parse configuration", err)
}
SetupLoggers(os.Stderr)
}
func TestCheckRateLimits(t *testing.T) {
setup(t)
err := CheckRateLimits()
if err != nil {
t.Fatal(err)
}
}
func TestSearchAccount(t *testing.T) {
//setup(t)
profile, err := SearchAccount("Andrea Masi")
if err != nil {
t.Fatal(err)
}
fmt.Println("account retrieved:", profile)
}
func TestGetFriends(t *testing.T) {
//setup(t)
twd := &TwitterData{ScreenName: "eraclitux"}
err := GetFriends(twd)
if err != nil {
t.Fatal(err)
}
fmt.Println("friends retrieved:", len(twd.Friends))
}