MCPcopy Create free account
hub / github.com/archlinux-de/pkgstats-cli / TestMultipleBlocklists

Function TestMultipleBlocklists

cmd/submit_test.go:80–108  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

78}
79
80func TestMultipleBlocklists(t *testing.T) {
81 if os.Getenv("INTEGRATION_TEST") == "1" {
82 t.Skip("Skipping multiple blocklists test in integration mode")
83 }
84
85 output, err := pkgstats(t, []string{"submit", "--dump-json"},
86 WithPkgBlocklist([]string{"secret-*", "*-dev"}),
87 WithMirrorBlocklist([]string{"private.mirror.com", "*.internal.net"}),
88 WithMirror("http://private.mirror.com/archlinux/$repo/os/$arch"),
89 )
90 if err != nil {
91 t.Fatalf("Failed to run command: %v", err)
92 }
93
94 var request submit.Request
95 if err := json.Unmarshal([]byte(output), &request); err != nil {
96 t.Fatalf("Failed to unmarshal JSON: %v", err)
97 }
98
99 if request.Pacman.Mirror != "" {
100 t.Errorf("Expected pacman mirror to be empty, got %v", request.Pacman.Mirror)
101 }
102 if slices.Contains(request.Pacman.Packages, "secret-package") {
103 t.Errorf("Expected pacman packages to not contain 'secret-package'")
104 }
105 if slices.Contains(request.Pacman.Packages, "my-app-dev") {
106 t.Errorf("Expected pacman packages to not contain 'my-app-dev'")
107 }
108}
109
110func TestComplexGlobPatterns(t *testing.T) {
111 if os.Getenv("INTEGRATION_TEST") == "1" {

Callers

nothing calls this directly

Calls 4

pkgstatsFunction · 0.85
WithPkgBlocklistFunction · 0.85
WithMirrorBlocklistFunction · 0.85
WithMirrorFunction · 0.85

Tested by

no test coverage detected