aboutsummaryrefslogtreecommitdiffstats
path: root/integrations
diff options
context:
space:
mode:
Diffstat (limited to 'integrations')
-rw-r--r--integrations/api_packages_nuget_test.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/integrations/api_packages_nuget_test.go b/integrations/api_packages_nuget_test.go
index 346f391f82..06eb485541 100644
--- a/integrations/api_packages_nuget_test.go
+++ b/integrations/api_packages_nuget_test.go
@@ -24,9 +24,16 @@ import (
"github.com/stretchr/testify/assert"
)
+func addNuGetAPIKeyHeader(request *http.Request, token string) *http.Request {
+ request.Header.Set("X-NuGet-ApiKey", token)
+ return request
+}
+
func TestPackageNuGet(t *testing.T) {
defer prepareTestEnv(t)()
+
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2}).(*user_model.User)
+ token := getUserToken(t, user.Name)
packageName := "test.package"
packageVersion := "1.0.3"
@@ -60,6 +67,10 @@ func TestPackageNuGet(t *testing.T) {
req := NewRequest(t, "GET", fmt.Sprintf("%s/index.json", url))
req = AddBasicAuthHeader(req, user.Name)
+ MakeRequest(t, req, http.StatusOK)
+
+ req = NewRequest(t, "GET", fmt.Sprintf("%s/index.json", url))
+ req = addNuGetAPIKeyHeader(req, token)
resp := MakeRequest(t, req, http.StatusOK)
var result nuget.ServiceIndexResponse