Set service url via parameter/env
Change-Id: I560568e8c77b3898948a7a7260e00102c996dc49
diff --git a/service_test.go b/service_test.go
index 08a576b..e32b821 100644
--- a/service_test.go
+++ b/service_test.go
@@ -75,7 +75,7 @@
assert.Contains(t, w.Body.String(), "<title>External Provider</title>")
}
-func TestAssetRoute(t *testing.T) {
+func TestManifestRoute(t *testing.T) {
router := setupRouter()
@@ -85,6 +85,22 @@
router.ServeHTTP(w, req)
assert.Equal(t, http.StatusOK, w.Code)
- assert.Equal(t, w.Header().Get("Content-Type"), "application/json")
+ assert.Contains(t, w.Header().Get("Content-Type"), "application/json")
assert.Contains(t, w.Body.String(), "permissions")
+ assert.Contains(t, w.Body.String(), "/plugin/external")
+
+ os.Setenv("KORAP_EXTERNAL_PROVIDER", "https://korap.ids-mannheim.de/plugin/fun")
+
+ router = setupRouter()
+
+ w = httptest.NewRecorder()
+ req, _ = http.NewRequest(http.MethodGet, "/plugin.json", nil)
+
+ router.ServeHTTP(w, req)
+
+ assert.Equal(t, http.StatusOK, w.Code)
+ assert.Contains(t, w.Header().Get("Content-Type"), "application/json")
+ assert.Contains(t, w.Body.String(), "permissions")
+ assert.Contains(t, w.Body.String(), "/plugin/fun")
+
}