func TestSingleFileUpload(t *testing.T) { flags := tests.GetFlags() uploadCount1 := Upload("testdata/a.txt", "repo-local", flags) uploadCount2 := Upload("testdata/aa.txt", "repo-local", flags) if uploadCount1 != 1 { t.Error("Expected 1 file to be uploaded. Got " + strconv.Itoa(uploadCount1) + ".") } if uploadCount2 != 1 { t.Error("Expected 1 file to be uploaded. Got " + strconv.Itoa(uploadCount2) + ".") } }
func TestRecursiveDownload(t *testing.T) { flags := tests.GetFlags() flags.Recursive = true aqlResult := Download("repo-local", flags) expected := "items.find({\"repo\": \"repo-local\",\"$or\": [{\"$and\": [{\"path\": {\"$match\":\"*\"},\"name\":{\"$match\":\"*\"}}]}]})" if aqlResult != expected { t.Error("Unexpected download AQL query built. Expected: " + expected + " Got " + aqlResult) } aqlResult = Download("repo-local2/a*b*c/dd/", flags) expected = "items.find({\"repo\": \"repo-local2\",\"$or\": [{\"$and\": [{\"path\": {\"$match\":\"a*b*c/dd\"},\"name\":{\"$match\":\"*\"}}]},{\"$and\": [{\"path\": {\"$match\":\"a*b*c/dd/*\"},\"name\":{\"$match\":\"*\"}}]}]})" if aqlResult != expected { t.Error("Unexpected download AQL query built. Expected: " + expected + " Got " + aqlResult) } }
func TestPatternNonRecursiveUpload(t *testing.T) { flags := tests.GetFlags() flags.Recursive = false testPatternUpload(t, flags) }