-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathtimeline_test.go
66 lines (58 loc) · 1.17 KB
/
timeline_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
61
62
63
64
65
66
package instago
import (
"testing"
)
func ExampleGetTimeline(t *testing.T) {
mgr, err := NewInstagramApiManager("auth.json")
if err != nil {
t.Error(err)
return
}
tl, err := mgr.GetTimeline()
if err != nil {
t.Error(err)
return
}
for _, item := range tl.Items {
if item.EndOfFeedDemarcator.Title != "" {
t.Log(item.EndOfFeedDemarcator)
if item.IsRegularMedia() == true {
t.Error("IsRegularMedia() should be false")
}
continue
}
if item.Injected.Label != "" {
t.Log(item.Injected.AdTitle)
if item.IsRegularMedia() == true {
t.Error("IsRegularMedia() should be false")
}
continue
}
if item.Type == 2 {
t.Log(item.Suggestions)
if item.IsRegularMedia() == true {
t.Error("IsRegularMedia() should be false")
}
continue
}
t.Log(item.MediaType)
if item.IsRegularMedia() == false {
t.Error("IsRegularMedia() should be true")
}
}
}
func ExampleGetTimelineUntilPageN(t *testing.T) {
mgr, err := NewInstagramApiManager("auth.json")
if err != nil {
t.Error(err)
return
}
items, err := mgr.GetTimelineUntilPageN(5)
if err != nil {
t.Error(err)
return
}
for _, item := range items {
t.Log(item)
}
}