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/git/vole.git

Write over SSH with a registered key:

git clone ssh://git@0.0.0.0:2222/vole.git

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

Blame · core/role/role_test.go

Line attribution on main · 31 line(s)

727df386
Keenan Nemetz
8d ago
1 package role
2
3 import "testing"
4
5 func TestParseAndOrder(t *testing.T) {
6 t.Parallel()
7 for in, want := range map[string]Role{
8 "": None,
9 "none": None,
10 "read": Read,
11 "contrib": Contribute,
12 "contributor": Contribute,
13 "contribute": Contribute,
14 "write": Maintain,
15 "maintainer": Maintain,
16 "maintain": Maintain,
17 "owner": Admin,
18 "admin": Admin,
19 } {
20 got, err := Parse(in)
21 if err != nil || got != want {
22 t.Errorf("Parse(%q) = %v, %v; want %v", in, got, err, want)
23 }
24 }
25 if _, err := Parse("wizard"); err == nil {
26 t.Fatal("Parse accepted an unknown role")
27 }
28 if !Admin.AtLeast(Maintain) || Contribute.AtLeast(Maintain) || !Maintain.AtLeast(Maintain) {
29 t.Fatal("role ordering is not minimum-role ordering")
30 }
31 }