MCPcopy Create free account
hub / github.com/github/gh-aw / TestPermissionsParser_ToPermissions

Function TestPermissionsParser_ToPermissions

pkg/workflow/permissions_parser_test.go:592–705  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

590}
591
592func TestPermissionsParser_ToPermissions(t *testing.T) {
593 tests := []struct {
594 name string
595 input any
596 wantYAML string
597 contains []string
598 notContains []string
599 }{
600 {
601 name: "shorthand read-all",
602 input: "read-all",
603 wantYAML: "permissions: read-all",
604 },
605 {
606 name: "shorthand write-all",
607 input: "write-all",
608 wantYAML: "permissions: write-all",
609 },
610 {
611 name: "all: read without overrides",
612 input: map[string]any{
613 "all": "read",
614 },
615 contains: []string{
616 "permissions:",
617 " actions: read",
618 " contents: read",
619 " issues: read",
620 },
621 notContains: []string{
622 " id-token: read", // id-token doesn't support read
623 },
624 },
625 {
626 name: "all: read with contents: write override",
627 input: map[string]any{
628 "all": "read",
629 "contents": "write",
630 },
631 contains: []string{
632 "permissions:",
633 " actions: read",
634 " contents: write", // Override
635 " issues: read",
636 },
637 notContains: []string{
638 " contents: read",
639 },
640 },
641 {
642 name: "all: read with id-token: write override",
643 input: map[string]any{
644 "all": "read",
645 "id-token": "write",
646 },
647 contains: []string{
648 "permissions:",
649 " actions: read",

Callers

nothing calls this directly

Calls 5

ToPermissionsMethod · 0.80
RenderToYAMLMethod · 0.80
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected