diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2023-08-14 04:50:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-14 04:50:55 +0200 |
commit | ecd51f710b7b08eddc952d518f0d097367221388 (patch) | |
tree | efef4d3efadc0480af58b270b6c93a9aecfdc421 /tests | |
parent | Fix tooltip of commit select button (#26472) (diff) | |
download | forgejo-ecd51f710b7b08eddc952d518f0d097367221388.tar.xz forgejo-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.go | 18 |
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) { |