aboutsummaryrefslogtreecommitdiffstats
path: root/community/rest-server/0001-Move-TestIsUserPath-to-correct-package.patch
blob: 5c3932f849a6aca707862352b78a73562095e61d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
From 69ed06aa661590ae74e4e839f71f6861d5fb4243 Mon Sep 17 00:00:00 2001
From: Alexander Neumann <alexander@bumpern.de>
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