(t *testing.T)
| 693 | } |
| 694 | |
| 695 | func TestRootNamespaceID(t *testing.T) { |
| 696 | tests := []struct { |
| 697 | name string |
| 698 | account *users.FullAccount |
| 699 | want string |
| 700 | }{ |
| 701 | { |
| 702 | name: "team root", |
| 703 | account: testRootFullAccount(common.NewTeamRootInfo("team-root", "home-ns", "/Member")), |
| 704 | want: "team-root", |
| 705 | }, |
| 706 | { |
| 707 | name: "user root", |
| 708 | account: testRootFullAccount(common.NewUserRootInfo("user-root", "home-ns")), |
| 709 | want: "user-root", |
| 710 | }, |
| 711 | { |
| 712 | name: "nil account", |
| 713 | account: nil, |
| 714 | want: "", |
| 715 | }, |
| 716 | { |
| 717 | name: "nil root info", |
| 718 | account: testRootFullAccount(nil), |
| 719 | want: "", |
| 720 | }, |
| 721 | } |
| 722 | |
| 723 | for _, tt := range tests { |
| 724 | t.Run(tt.name, func(t *testing.T) { |
| 725 | if got := rootNamespaceID(tt.account); got != tt.want { |
| 726 | t.Fatalf("root namespace ID = %q, want %q", got, tt.want) |
| 727 | } |
| 728 | }) |
| 729 | } |
| 730 | } |
| 731 | |
| 732 | func testRootFullAccount(rootInfo common.IsRootInfo) *users.FullAccount { |
| 733 | return users.NewFullAccount( |
nothing calls this directly
no test coverage detected