Add Swift login endpoint (#32693)

Fix #32683

This PR adds the login endpoint and fixes the documentation links.

(cherry picked from commit 136408307c6de7aac2ab5476f8cddf90f39355dc)

Conflicts:
	routers/api/packages/api.go
  trivial context conflicts
This commit is contained in:
KN4CK3R 2024-12-03 17:24:16 +01:00 committed by Earl Warren
parent 48131547a1
commit 0786ddc5de
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
3 changed files with 76 additions and 42 deletions

View file

@ -43,6 +43,24 @@ func TestPackageSwift(t *testing.T) {
url := fmt.Sprintf("/api/packages/%s/swift", user.Name)
t.Run("CheckLogin", func(t *testing.T) {
defer tests.PrintCurrentTest(t)()
req := NewRequestWithBody(t, "POST", url, strings.NewReader(""))
MakeRequest(t, req, http.StatusUnauthorized)
req = NewRequestWithBody(t, "POST", url, strings.NewReader("")).
AddBasicAuth(user.Name)
MakeRequest(t, req, http.StatusOK)
req = NewRequestWithBody(t, "POST", url+"/login", strings.NewReader(""))
MakeRequest(t, req, http.StatusUnauthorized)
req = NewRequestWithBody(t, "POST", url+"/login", strings.NewReader("")).
AddBasicAuth(user.Name)
MakeRequest(t, req, http.StatusOK)
})
t.Run("CheckAcceptMediaType", func(t *testing.T) {
defer tests.PrintCurrentTest(t)()