aboutsummaryrefslogtreecommitdiff
path: root/internal/admin/service_test.go
diff options
context:
space:
mode:
authorMax Resnick <max@ofmax.li>2025-03-29 16:29:49 -0700
committerMax Resnick <max@ofmax.li>2025-03-29 16:31:35 -0700
commit6d4cd2c3353c6d94a3d29f675388e647788a83c3 (patch)
treea3e92af5466c4cb3441ba88fbe5821c9c9baa34b /internal/admin/service_test.go
parent657ec55ac99aa06514710e9d72329f1d80c59118 (diff)
downloadgo-git-server-6d4cd2c3353c6d94a3d29f675388e647788a83c3.tar.gz
feat: upgrade token security, upgrade go, packages, fix linting issues
Token generation changes: 1. Increasing to 32 bytes (256 bits) of entropy 2. Using crypto/rand.Read directly instead of loop
Diffstat (limited to '')
-rw-r--r--internal/admin/service_test.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/internal/admin/service_test.go b/internal/admin/service_test.go
index 06088bc..9af6bb9 100644
--- a/internal/admin/service_test.go
+++ b/internal/admin/service_test.go
@@ -108,7 +108,12 @@ func TestInitServer(t *testing.T) {
{"role:maintainers", "/thisismynewrepo/git-receive-pack", "POST"},
}
for _, policy := range expectedPolicies {
- if !svc.HasPolicy(policy[0], policy[1], policy[2]) {
+ hasPolicy, err := svc.HasPolicy(policy[0], policy[1], policy[2])
+ if err != nil {
+ t.Log("error checking policies", err)
+ t.Fail()
+ }
+ if !hasPolicy {
t.Log("policy not found", policy)
t.Fail()
}
@@ -136,10 +141,16 @@ func TestInitServer(t *testing.T) {
{"role:admin", "/mgmt/git-receive-pack", "POST"},
}
for _, policy := range expectedPolicies {
- if !svc.HasPolicy(policy[0], policy[1], policy[2]) {
+ hasPolicy, err := svc.HasPolicy(policy[0], policy[1], policy[2])
+ if err != nil {
+ t.Log("error checking policies", err)
+ t.Fail()
+ }
+ if !hasPolicy {
t.Log("policy not found", policy)
t.Fail()
}
+
}
})
t.Run("test an unitialized server config", func(t *testing.T) {