aboutsummaryrefslogtreecommitdiffstats
path: root/testing/rest-server
diff options
context:
space:
mode:
authorSören Tempel <soeren+git@soeren-tempel.net>2018-07-24 16:30:45 +0200
committerSören Tempel <soeren+git@soeren-tempel.net>2018-07-25 00:03:27 +0200
commit698fe31ce35c3da127dbe6f10160aa96e7d435eb (patch)
tree39d7d5c43b512cb4a683efeb10be4204cb58b235 /testing/rest-server
parent06d068b61042ff85f92c4d970c425a42753e6127 (diff)
downloadaports-698fe31ce35c3da127dbe6f10160aa96e7d435eb.tar.bz2
aports-698fe31ce35c3da127dbe6f10160aa96e7d435eb.tar.xz
testing/rest-server: add check
Diffstat (limited to 'testing/rest-server')
-rw-r--r--testing/rest-server/0001-Move-TestIsUserPath-to-correct-package.patch71
-rw-r--r--testing/rest-server/APKBUILD11
2 files changed, 80 insertions, 2 deletions
diff --git a/testing/rest-server/0001-Move-TestIsUserPath-to-correct-package.patch b/testing/rest-server/0001-Move-TestIsUserPath-to-correct-package.patch
new file mode 100644
index 0000000000..5c3932f849
--- /dev/null
+++ b/testing/rest-server/0001-Move-TestIsUserPath-to-correct-package.patch
@@ -0,0 +1,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
+
diff --git a/testing/rest-server/APKBUILD b/testing/rest-server/APKBUILD
index 1047db7ea9..d939c3e6c0 100644
--- a/testing/rest-server/APKBUILD
+++ b/testing/rest-server/APKBUILD
@@ -11,7 +11,8 @@ depends=""
makedepends="go"
install=""
subpackages="$pkgname-doc"
-source="$pkgname-$pkgver.tar.gz::https://github.com/restic/$pkgname/archive/v$pkgver.tar.gz"
+source="$pkgname-$pkgver.tar.gz::https://github.com/restic/$pkgname/archive/v$pkgver.tar.gz
+ 0001-Move-TestIsUserPath-to-correct-package.patch"
builddir="$srcdir/src/github.com/restic/$pkgname"
export GOPATH="$srcdir"
@@ -27,6 +28,11 @@ build() {
go build ./cmd/...
}
+check() {
+ cd "$builddir"
+ go test -v . ./cmd/rest-server
+}
+
package() {
cd "$builddir"
@@ -35,4 +41,5 @@ package() {
"$pkgdir"/usr/share/doc/$pkgname/README.md
}
-sha512sums="2288f93703d03859ec1a5d9085eda7ca5b82e801bc74cd66fcc58601e73a2bf5150f85e948749ca7d95e4598087acf5115499404ccbbfba62a4cc9043437ed29 rest-server-0.9.7.tar.gz"
+sha512sums="2288f93703d03859ec1a5d9085eda7ca5b82e801bc74cd66fcc58601e73a2bf5150f85e948749ca7d95e4598087acf5115499404ccbbfba62a4cc9043437ed29 rest-server-0.9.7.tar.gz
+98a9fbb7c0b60dbb3682bab40f7b4f488da93d7c7afdab174185bc62ad250bf8e1238b6513a239dd5da276935b51bd05495f13c7e03befa3a0f651cf3d109979 0001-Move-TestIsUserPath-to-correct-package.patch"