Skip to content

Commit

Permalink
Merge pull request #34 from bzimmer/iter
Browse files Browse the repository at this point in the history
added tests for node iteration
  • Loading branch information
bzimmer authored Oct 11, 2021
2 parents a02eccf + bc6851c commit 878f837
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions ls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ func TestList(t *testing.T) {
w.WriteHeader(http.StatusNotFound)
a.NoError(copyFile(w, "testdata/album_qety_404.json"))
})
mux.HandleFunc("/node/VsQ7zr", func(w http.ResponseWriter, r *http.Request) {
a.NoError(copyFile(w, "testdata/node_VsQ7zr.json"))
})
mux.HandleFunc("/album/TDZWbg", func(w http.ResponseWriter, r *http.Request) {
a.NoError(copyFile(w, "testdata/album_TDZWbg.json"))
})
mux.HandleFunc("/album/TDZWbg!images", func(w http.ResponseWriter, r *http.Request) {
a.NoError(copyFile(w, "testdata/album_TDZWbg_images.json"))
})
}

tests := []struct {
Expand Down Expand Up @@ -72,6 +81,29 @@ func TestList(t *testing.T) {
args: []string{"ma", "ls", "album", "qety"},
err: "Not Found",
},
{
name: "node type album with no album flag",
args: []string{"ma", "ls", "node", "VsQ7zr"},
counters: map[string]int{
"ma.ls.node": 1,
},
},
{
name: "node recurse and image",
args: []string{"ma", "ls", "node", "-R", "-i", "VsQ7zr"},
counters: map[string]int{
"ma.ls.node": 1,
"ma.ls.image": 1,
},
},
{
name: "album recurse and image",
args: []string{"ma", "ls", "album", "-i", "TDZWbg"},
counters: map[string]int{
"ma.ls.album": 1,
"ma.ls.image": 1,
},
},
}

for _, tt := range tests {
Expand Down

0 comments on commit 878f837

Please sign in to comment.