+5
.golangci.yml
+5
.golangci.yml
-6
pkg/appview/middleware/registry_test.go
-6
pkg/appview/middleware/registry_test.go
···
45
45
return nil
46
46
}
47
47
48
-
// mockRepository is a minimal mock implementation
49
-
type mockRepository struct {
50
-
distribution.Repository
51
-
name string
52
-
}
53
-
54
48
func TestSetGlobalRefresher(t *testing.T) {
55
49
// Test that SetGlobalRefresher doesn't panic
56
50
SetGlobalRefresher(nil)
-6
pkg/appview/storage/context_test.go
-6
pkg/appview/storage/context_test.go
···
17
17
return m.holdDID, nil
18
18
}
19
19
20
-
type mockHoldAuthorizer struct{}
21
-
22
-
func (m *mockHoldAuthorizer) Authorize(holdDID, userDID, permission string) (bool, error) {
23
-
return true, nil
24
-
}
25
-
26
20
func TestRegistryContext_Fields(t *testing.T) {
27
21
// Create a sample RegistryContext
28
22
ctx := &RegistryContext{
-10
pkg/auth/oauth/server_test.go
-10
pkg/auth/oauth/server_test.go
···
115
115
}
116
116
}
117
117
118
-
type mockRefresher struct {
119
-
invalidateSessionFunc func(did string)
120
-
}
121
-
122
-
func (m *mockRefresher) InvalidateSession(did string) {
123
-
if m.invalidateSessionFunc != nil {
124
-
m.invalidateSessionFunc(did)
125
-
}
126
-
}
127
-
128
118
// ServeAuthorize tests
129
119
130
120
func TestServer_ServeAuthorize_MissingHandle(t *testing.T) {
-2
pkg/auth/token/handler_test.go
-2
pkg/auth/token/handler_test.go
···
2
2
3
3
import (
4
4
"context"
5
-
"crypto/rsa"
6
5
"crypto/tls"
7
6
"database/sql"
8
7
"encoding/base64"
···
22
21
// Shared test key to avoid generating a new RSA key for each test
23
22
// Generating a 2048-bit RSA key takes ~0.15s, so reusing one key saves ~4.5s for 32 tests
24
23
var (
25
-
sharedTestKey *rsa.PrivateKey
26
24
sharedTestKeyPath string
27
25
sharedTestKeyOnce sync.Once
28
26
sharedTestKeyDir string
-1
pkg/auth/token/issuer_test.go
-1
pkg/auth/token/issuer_test.go
···
19
19
// Shared test key to avoid generating a new RSA key for each test
20
20
// Generating a 2048-bit RSA key takes ~0.15s, so reusing one key saves significant time
21
21
var (
22
-
issuerSharedTestKey *rsa.PrivateKey
23
22
issuerSharedTestKeyPath string
24
23
issuerSharedTestKeyOnce sync.Once
25
24
issuerSharedTestKeyDir string
-20
pkg/hold/pds/records_test.go
-20
pkg/hold/pds/records_test.go
···
1
1
package pds
2
2
3
3
import (
4
-
"context"
5
4
"os"
6
5
"path/filepath"
7
6
"testing"
8
7
9
-
"github.com/bluesky-social/indigo/repo"
10
8
_ "github.com/mattn/go-sqlite3"
11
9
)
12
10
···
607
605
t.Errorf("Expected captain count 1 after deleting crew, got %d", count)
608
606
}
609
607
}
610
-
611
-
// mockRepo is a minimal mock for testing backfill
612
-
// Note: Full backfill testing requires integration tests with real repo
613
-
type mockRepo struct {
614
-
records map[string]string // key -> cid
615
-
}
616
-
617
-
func (m *mockRepo) ForEach(ctx context.Context, prefix string, fn func(string, any) error) error {
618
-
for k, v := range m.records {
619
-
if err := fn(k, v); err != nil {
620
-
if err == repo.ErrDoneIterating {
621
-
return nil
622
-
}
623
-
return err
624
-
}
625
-
}
626
-
return nil
627
-
}