aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2023-08-14 04:50:55 +0200
committerGitHub <noreply@github.com>2023-08-14 02:50:55 +0000
commitecd51f710b7b08eddc952d518f0d097367221388 (patch)
treeefef4d3efadc0480af58b270b6c93a9aecfdc421 /tests
parent56b6b2b88ef175cc18d2ccdb86c220e885a24262 (diff)
downloadgitea-ecd51f710b7b08eddc952d518f0d097367221388.tar.gz
gitea-ecd51f710b7b08eddc952d518f0d097367221388.zip
Fix NuGet search endpoints (#25613)
Fixes #25564 Fixes #23191 - Api v2 search endpoint should return only the latest version matching the query - Api v3 search endpoint should return `take` packages not package versions
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/api_packages_nuget_test.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/integration/api_packages_nuget_test.go b/tests/integration/api_packages_nuget_test.go
index e4ea92ee11..520d1dd0a7 100644
--- a/tests/integration/api_packages_nuget_test.go
+++ b/tests/integration/api_packages_nuget_test.go
@@ -414,6 +414,10 @@ AAAjQmxvYgAAAGm7ENm9SGxMtAFVvPUsPJTF6PbtAAAAAFcVogEJAAAAAQAAAA==`)
{"test", 1, 10, 1, 0},
}
+ req := NewRequestWithBody(t, "PUT", url, createPackage(packageName, "1.0.99"))
+ req = AddBasicAuthHeader(req, user.Name)
+ MakeRequest(t, req, http.StatusCreated)
+
t.Run("v2", func(t *testing.T) {
t.Run("Search()", func(t *testing.T) {
defer tests.PrintCurrentTest(t)()
@@ -493,10 +497,6 @@ AAAjQmxvYgAAAGm7ENm9SGxMtAFVvPUsPJTF6PbtAAAAAFcVogEJAAAAAQAAAA==`)
req = AddBasicAuthHeader(req, user.Name)
MakeRequest(t, req, http.StatusCreated)
- req = NewRequestWithBody(t, "PUT", url, createPackage(packageName, "1.0.99"))
- req = AddBasicAuthHeader(req, user.Name)
- MakeRequest(t, req, http.StatusCreated)
-
req = NewRequest(t, "GET", fmt.Sprintf("%s/query?q=%s", url, packageName))
req = AddBasicAuthHeader(req, user.Name)
resp := MakeRequest(t, req, http.StatusOK)
@@ -504,7 +504,7 @@ AAAjQmxvYgAAAGm7ENm9SGxMtAFVvPUsPJTF6PbtAAAAAFcVogEJAAAAAQAAAA==`)
var result nuget.SearchResultResponse
DecodeJSON(t, resp, &result)
- assert.EqualValues(t, 3, result.TotalHits)
+ assert.EqualValues(t, 2, result.TotalHits)
assert.Len(t, result.Data, 2)
for _, sr := range result.Data {
if sr.ID == packageName {
@@ -517,12 +517,12 @@ AAAjQmxvYgAAAGm7ENm9SGxMtAFVvPUsPJTF6PbtAAAAAFcVogEJAAAAAQAAAA==`)
req = NewRequest(t, "DELETE", fmt.Sprintf("%s/%s/%s", url, packageName+".dummy", "1.0.0"))
req = AddBasicAuthHeader(req, user.Name)
MakeRequest(t, req, http.StatusNoContent)
-
- req = NewRequest(t, "DELETE", fmt.Sprintf("%s/%s/%s", url, packageName, "1.0.99"))
- req = AddBasicAuthHeader(req, user.Name)
- MakeRequest(t, req, http.StatusNoContent)
})
})
+
+ req = NewRequest(t, "DELETE", fmt.Sprintf("%s/%s/%s", url, packageName, "1.0.99"))
+ req = AddBasicAuthHeader(req, user.Name)
+ MakeRequest(t, req, http.StatusNoContent)
})
t.Run("RegistrationService", func(t *testing.T) {