refactor: finish whitelist-to-allowlist rename in imgcache
All checks were successful
check / check (push) Successful in 6s

This commit is contained in:
2026-08-07 21:24:31 +07:00
parent d69019b9d1
commit 43b9f1cb59
6 changed files with 37 additions and 37 deletions

View File

@@ -10,7 +10,7 @@ import (
"sneak.berlin/go/pixa/internal/signature"
)
func TestService_Get_WhitelistedHost(t *testing.T) {
func TestService_Get_AllowlistedHost(t *testing.T) {
svc, fixtures := SetupTestService(t)
ctx := context.Background()
@@ -44,7 +44,7 @@ func TestService_Get_WhitelistedHost(t *testing.T) {
}
}
func TestService_Get_NonWhitelistedHost_NoSignature(t *testing.T) {
func TestService_Get_NonAllowlistedHost_NoSignature(t *testing.T) {
svc, fixtures := SetupTestService(t, WithSigningKey("test-key"))
req := &ImageRequest{
@@ -56,14 +56,14 @@ func TestService_Get_NonWhitelistedHost_NoSignature(t *testing.T) {
FitMode: FitCover,
}
// Should fail validation - not whitelisted and no signature
// Should fail validation - not allowlisted and no signature
err := svc.ValidateRequest(req)
if err == nil {
t.Error("ValidateRequest() expected error for non-whitelisted host without signature")
t.Error("ValidateRequest() expected error for non-allowlisted host without signature")
}
}
func TestService_Get_NonWhitelistedHost_ValidSignature(t *testing.T) {
func TestService_Get_NonAllowlistedHost_ValidSignature(t *testing.T) {
signingKey := "test-signing-key-12345"
svc, fixtures := SetupTestService(t, WithSigningKey(signingKey))
ctx := context.Background()
@@ -105,7 +105,7 @@ func TestService_Get_NonWhitelistedHost_ValidSignature(t *testing.T) {
}
}
func TestService_Get_NonWhitelistedHost_ExpiredSignature(t *testing.T) {
func TestService_Get_NonAllowlistedHost_ExpiredSignature(t *testing.T) {
signingKey := "test-signing-key-12345"
svc, fixtures := SetupTestService(t, WithSigningKey(signingKey))
@@ -130,7 +130,7 @@ func TestService_Get_NonWhitelistedHost_ExpiredSignature(t *testing.T) {
}
}
func TestService_Get_NonWhitelistedHost_InvalidSignature(t *testing.T) {
func TestService_Get_NonAllowlistedHost_InvalidSignature(t *testing.T) {
signingKey := "test-signing-key-12345"
svc, fixtures := SetupTestService(t, WithSigningKey(signingKey))
@@ -162,7 +162,7 @@ func TestService_ValidateRequest_SignatureExactHostMatch(t *testing.T) {
signingKey := "test-signing-key-must-be-32-chars"
svc, _ := SetupTestService(t,
WithSigningKey(signingKey),
WithNoWhitelist(),
WithNoAllowlist(),
)
signer := signature.New(signingKey)
@@ -438,8 +438,8 @@ func TestService_Get_DifferentSizes(t *testing.T) {
}
func TestService_ValidateRequest_NoSigningKey(t *testing.T) {
// Service with no signing key - all non-whitelisted requests should fail
svc, fixtures := SetupTestService(t, WithNoWhitelist())
// Service with no signing key - all non-allowlisted requests should fail
svc, fixtures := SetupTestService(t, WithNoAllowlist())
req := &ImageRequest{
SourceHost: fixtures.OtherHost,
@@ -452,7 +452,7 @@ func TestService_ValidateRequest_NoSigningKey(t *testing.T) {
err := svc.ValidateRequest(req)
if err == nil {
t.Error("ValidateRequest() expected error when no signing key and host not whitelisted")
t.Error("ValidateRequest() expected error when no signing key and host not allowlisted")
}
}