(t *testing.T)
| 107 | } |
| 108 | |
| 109 | func TestShowOrganizations(t *testing.T) { |
| 110 | t.Parallel() |
| 111 | |
| 112 | t.Run("OnlyID", func(t *testing.T) { |
| 113 | t.Parallel() |
| 114 | |
| 115 | ownerClient, first := coderdenttest.New(t, &coderdenttest.Options{ |
| 116 | Options: &coderdtest.Options{ |
| 117 | IncludeProvisionerDaemon: true, |
| 118 | }, |
| 119 | LicenseOptions: &coderdenttest.LicenseOptions{ |
| 120 | Features: license.Features{ |
| 121 | codersdk.FeatureMultipleOrganizations: 1, |
| 122 | codersdk.FeatureExternalProvisionerDaemons: 1, |
| 123 | }, |
| 124 | }, |
| 125 | }) |
| 126 | |
| 127 | // Owner is required to make orgs |
| 128 | client, _ := coderdtest.CreateAnotherUser(t, ownerClient, first.OrganizationID, rbac.RoleOwner()) |
| 129 | |
| 130 | ctx := testutil.Context(t, testutil.WaitMedium) |
| 131 | orgs := []string{"foo", "bar"} |
| 132 | for _, orgName := range orgs { |
| 133 | _, err := client.CreateOrganization(ctx, codersdk.CreateOrganizationRequest{ |
| 134 | Name: orgName, |
| 135 | }) |
| 136 | require.NoError(t, err) |
| 137 | } |
| 138 | |
| 139 | inv, root := clitest.New(t, "organizations", "show", "--only-id", "--org="+first.OrganizationID.String()) |
| 140 | clitest.SetupConfig(t, client, root) |
| 141 | pty := ptytest.New(t).Attach(inv) |
| 142 | errC := make(chan error) |
| 143 | go func() { |
| 144 | errC <- inv.Run() |
| 145 | }() |
| 146 | require.NoError(t, <-errC) |
| 147 | pty.ExpectMatch(first.OrganizationID.String()) |
| 148 | }) |
| 149 | |
| 150 | t.Run("UsingFlag", func(t *testing.T) { |
| 151 | t.Parallel() |
| 152 | ownerClient, first := coderdenttest.New(t, &coderdenttest.Options{ |
| 153 | Options: &coderdtest.Options{ |
| 154 | IncludeProvisionerDaemon: true, |
| 155 | }, |
| 156 | LicenseOptions: &coderdenttest.LicenseOptions{ |
| 157 | Features: license.Features{ |
| 158 | codersdk.FeatureMultipleOrganizations: 1, |
| 159 | codersdk.FeatureExternalProvisionerDaemons: 1, |
| 160 | }, |
| 161 | }, |
| 162 | }) |
| 163 | |
| 164 | // Owner is required to make orgs |
| 165 | client, _ := coderdtest.CreateAnotherUser(t, ownerClient, first.OrganizationID, rbac.RoleOwner()) |
| 166 |
nothing calls this directly
no test coverage detected