oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package provider
2
3import "testing"
4
5func TestSpecialistToolPolicy(t *testing.T) {
6 allowed := []string{"submit_answer", "ask_person"}
7 if err := ValidateSpecialistTools(allowed, allowed, allowed, allowed); err != nil {
8 t.Fatal("certified subset denied", err)
9 }
10 for _, tc := range []struct {
11 name string
12 requested, team, project, certified []string
13 }{
14 {"command", []string{"sh -c deploy"}, []string{"sh -c deploy"}, []string{"sh -c deploy"}, []string{"sh -c deploy"}},
15 {"provider_tool", []string{"Bash"}, []string{"Bash"}, []string{"Bash"}, []string{"Bash"}},
16 {"team", allowed, []string{"ask_person"}, allowed, allowed},
17 {"project", allowed, allowed, []string{"ask_person"}, allowed},
18 {"certificate", allowed, allowed, allowed, []string{"ask_person"}},
19 {"duplicate", []string{"ask_person", "ask_person"}, allowed, allowed, allowed},
20 } {
21 t.Run(tc.name, func(t *testing.T) {
22 if ValidateSpecialistTools(tc.requested, tc.team, tc.project, tc.certified) == nil {
23 t.Fatal("tool authority widened")
24 }
25 })
26 }
27}
28