Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software:2222/vole.git

A free and open-source forge that lives in your Git repo.

refactor

c5902451905acdaa478f8476844ccd4a510d9ca9 · Keenan Nemetz · 17d ago · parent ec2aba4b

internal/repo/repo_test.go → forge/repo/repo_test.go +8−9

@@ -8,9 +8,8 @@ import (
8 8 "path/filepath"
9 9 "testing"
10 10
11 "github.com/rodent-software/vole/internal/access"
12 "github.com/rodent-software/vole/internal/acl"
13 "github.com/rodent-software/vole/internal/gitx"
11 "github.com/rodent-software/vole/core/git"
12 "github.com/rodent-software/vole/forge/access"
14 13 )
15 14
16 15 // withACLs returns a store whose rules live in a database beside the repositories, the
@@ -27,8 +26,8 @@ func withACLs(t *testing.T) (*Store, *access.Store) {
27 26 }
28 27
29 28 // legacyWriteACL does what the old code did: a commit on refs/vole/acl holding
30 // acl.json. It is how a pre-upgrade repository looks.
31 func legacyWriteACL(t *testing.T, m *Meta, a *acl.ACL) {
29 // access.json. It is how a pre-upgrade repository looks.
30 func legacyWriteACL(t *testing.T, m *Meta, a *access.ACL) {
32 31 t.Helper()
33 32 g := m.Git()
34 33 raw, err := a.Bytes()
@@ -39,7 +38,7 @@ func legacyWriteACL(t *testing.T, m *Meta, a *acl.ACL) {
39 38 if err != nil {
40 39 t.Fatal(err)
41 40 }
42 tree, err := g.MkTree([]gitx.Entry{{Mode: "100644", Type: "blob", SHA: blob, Name: ACLPath}})
41 tree, err := g.MkTree([]git.Entry{{Mode: "100644", Type: "blob", SHA: blob, Name: ACLPath}})
43 42 if err != nil {
44 43 t.Fatal(err)
45 44 }
@@ -64,7 +63,7 @@ func TestImportACLsTakesRulesFromTheOldRef(t *testing.T) {
64 63 if err := acls.Delete(m.ID); err != nil {
65 64 t.Fatal(err)
66 65 }
67 legacy := acl.Empty("01M5OWNER0000000000000000A")
66 legacy := access.Empty("01M5OWNER0000000000000000A")
68 67 if err := legacy.SetEntry("01M5WRITER000000000000000B", "write"); err != nil {
69 68 t.Fatal(err)
70 69 }
@@ -84,7 +83,7 @@ func TestImportACLsTakesRulesFromTheOldRef(t *testing.T) {
84 83 if err != nil {
85 84 t.Fatal(err)
86 85 }
87 if got.RoleFor("01M5WRITER000000000000000B") != acl.Write || !got.CanReport("01M5RUNNER000000000000000C") {
86 if got.RoleFor("01M5WRITER000000000000000B") != access.Write || !got.CanReport("01M5RUNNER000000000000000C") {
88 87 t.Fatalf("rules did not survive the import: %+v", got)
89 88 }
90 89
@@ -115,7 +114,7 @@ func TestImportACLsLeavesRepositoriesWithoutTheRefAlone(t *testing.T) {
115 114 if err != nil {
116 115 t.Fatal(err)
117 116 }
118 if got.RoleFor("01M5OWNER0000000000000000A") != acl.None {
117 if got.RoleFor("01M5OWNER0000000000000000A") != access.None {
119 118 t.Fatalf("a repository with no rules granted something: %+v", got)
120 119 }
121 120 }