This repository was archived by the owner on Aug 25, 2023. It is now read-only.
File tree 4 files changed +63
-6
lines changed
4 files changed +63
-6
lines changed Original file line number Diff line number Diff line change @@ -6,3 +6,30 @@ If you want to contribute to Goinsta API you must follow a simple instructions.
6
6
7
7
- ** Test your code after making pull request** . The title says it all.
8
8
- ** Include jokes if you can** . This instruction is optional.
9
+
10
+ # Tests
11
+
12
+ You need at least one goinsta exported object
13
+ ```
14
+ package main
15
+
16
+ import (
17
+ "fmt"
18
+ "github.com/ahmdrz/goinsta/v2"
19
+ "github.com/ahmdrz/goinsta/v2/utilities"
20
+ )
21
+
22
+ func main() {
23
+ inst := goinsta.New("user", "password")
24
+ err := inst.Login()
25
+ if err != nil {
26
+ fmt.Fatal(err)
27
+ }
28
+ fmt.Print(utilities.ExportAsBase64String(inst))
29
+ }
30
+ ```
31
+
32
+ Then you can use the output generated above to run your tests in the cli
33
+ ```
34
+ INSTAGRAM_BASE64_USERNAME=BASE64_OUTPUT go test ./...
35
+ ```
Original file line number Diff line number Diff line change @@ -131,10 +131,10 @@ func (ft *FeedTag) Next() bool {
131
131
},
132
132
)
133
133
if err == nil {
134
- newFT := FeedTag {}
135
- err = json .Unmarshal (body , & newFT )
134
+ newFT := & FeedTag {}
135
+ err = json .Unmarshal (body , newFT )
136
136
if err == nil {
137
- * ft = newFT
137
+ * ft = * newFT
138
138
ft .inst = insta
139
139
ft .name = name
140
140
if ! ft .MoreAvailable {
Original file line number Diff line number Diff line change @@ -101,10 +101,10 @@ func (h *Hashtag) Next() bool {
101
101
},
102
102
)
103
103
if err == nil {
104
- ht := Hashtag {}
105
- err = json .Unmarshal (body , & ht )
104
+ ht := & Hashtag {}
105
+ err = json .Unmarshal (body , ht )
106
106
if err == nil {
107
- * h = ht
107
+ * h = * ht
108
108
h .inst = insta
109
109
h .Name = name
110
110
if ! h .MoreAvailable {
Original file line number Diff line number Diff line change @@ -29,3 +29,33 @@ func TestFeedTagLike(t *testing.T) {
29
29
t .Logf ("media %s liked by goinsta" , item .ID )
30
30
}
31
31
}
32
+
33
+ func TestFeedTagNext (t * testing.T ) {
34
+ insta , err := getRandomAccount ()
35
+ if err != nil {
36
+ t .Fatal (err )
37
+ return
38
+ }
39
+ feedTag , err := insta .Feed .Tags ("golang" )
40
+ if err != nil {
41
+ t .Fatal (err )
42
+ return
43
+ }
44
+
45
+ initNextID := feedTag .NextID
46
+ success := feedTag .Next ()
47
+ if ! success {
48
+ t .Fatal ("Failed to fetch next page" )
49
+ return
50
+ }
51
+ gotStatus := feedTag .Status
52
+
53
+ if gotStatus != "ok" {
54
+ t .Errorf ("Status = %s; want ok" , gotStatus )
55
+ }
56
+
57
+ gotNextID := feedTag .NextID
58
+ if gotNextID == initNextID {
59
+ t .Errorf ("NextID must differ after FeedTag.Next() call" )
60
+ }
61
+ }
You can’t perform that action at this time.
0 commit comments