From 69ed06aa661590ae74e4e839f71f6861d5fb4243 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Tue, 20 Mar 2018 20:45:59 +0100 Subject: [PATCH] Move TestIsUserPath to correct package --- cmd/rest-server/main_test.go | 21 --------------------- handlers_test.go | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/cmd/rest-server/main_test.go b/cmd/rest-server/main_test.go index 44b06a2..b2a71e1 100644 --- a/cmd/rest-server/main_test.go +++ b/cmd/rest-server/main_test.go @@ -71,24 +71,3 @@ func TestTLSSettings(t *testing.T) { }) } } - -func TestIsUserPath(t *testing.T) { - var tests = []struct { - username string - path string - result bool - }{ - {"foo", "/", false}, - {"foo", "/foo", true}, - {"foo", "/foo/", true}, - {"foo", "/foo/bar", true}, - {"foo", "/foobar", false}, - } - - for _, test := range tests { - result := isUserPath(test.username, test.path) - if result != test.result { - t.Errorf("isUserPath(%q, %q) was incorrect, got: %v, want: %v.", test.username, test.path, result, test.result) - } - } -} diff --git a/handlers_test.go b/handlers_test.go index 6536a26..f6cdbaa 100644 --- a/handlers_test.go +++ b/handlers_test.go @@ -37,3 +37,24 @@ func TestJoin(t *testing.T) { }) } } + +func TestIsUserPath(t *testing.T) { + var tests = []struct { + username string + path string + result bool + }{ + {"foo", "/", false}, + {"foo", "/foo", true}, + {"foo", "/foo/", true}, + {"foo", "/foo/bar", true}, + {"foo", "/foobar", false}, + } + + for _, test := range tests { + result := isUserPath(test.username, test.path) + if result != test.result { + t.Errorf("isUserPath(%q, %q) was incorrect, got: %v, want: %v.", test.username, test.path, result, test.result) + } + } +} -- 2.18.0