forked from mirrors/pkg-proxy
* Fix all golangci-lint issues across the codebase Resolve 77 lint issues reported by golangci-lint with gocritic, gocognit, gocyclo, maintidx, dupl, mnd, unparam, ireturn, goconst, and errcheck enabled. Net reduction of ~175 lines through shared helpers and deduplication. * Suppress staticcheck SA1019 for intentional deprecated field usage The Storage.Path field is deprecated but still read for backwards compatibility with existing configs that haven't migrated to the URL field.
23 lines
811 B
Go
23 lines
811 B
Go
package handler
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestDebianHandler_parsePoolPath(t *testing.T) {
|
|
h := &DebianHandler{}
|
|
|
|
assertPathParser(t, "parsePoolPath", h.parsePoolPath, []pathParseCase{
|
|
{"pool/main/n/nginx/nginx_1.18.0-6_amd64.deb", "nginx", "1.18.0-6", "amd64"},
|
|
{"pool/main/libn/libncurses/libncurses6_6.2-1_amd64.deb", "libncurses6", "6.2-1", "amd64"},
|
|
{"pool/contrib/v/virtualbox/virtualbox_6.1.38-1_amd64.deb", "virtualbox", "6.1.38-1", "amd64"},
|
|
{"pool/main/g/git/git_2.39.2-1_arm64.deb", "git", "2.39.2-1", "arm64"},
|
|
{"invalid/path", "", "", ""},
|
|
{"pool/main/n/nginx/nginx.deb", "", "", ""},
|
|
})
|
|
}
|
|
|
|
func TestDebianHandler_Routes(t *testing.T) {
|
|
h := NewDebianHandler(nil, "http://localhost:8080")
|
|
assertRoutesBasics(t, h.Routes(), "/dists/stable/Release", "/pool/../../../etc/passwd")
|
|
}
|