From bc6851c053dbe9f81d3997a75cb690e5b1c62153 Mon Sep 17 00:00:00 2001 From: Brian Zimmer Date: Mon, 11 Oct 2021 09:38:13 -0700 Subject: [PATCH] added tests for node iteration --- ls_test.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/ls_test.go b/ls_test.go index fa32df2..3bf8810 100644 --- a/ls_test.go +++ b/ls_test.go @@ -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 { @@ -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 {