feat: implement organization context in the cli (#12259)

* feat: implement organization context in the cli

`coder org show current`
This commit is contained in:
Steven Masley
2024-02-26 10:03:49 -06:00
committed by GitHub
parent f44c89d200
commit d2998c6b7b
24 changed files with 290 additions and 52 deletions

View File

@ -66,7 +66,7 @@ func TestOrganizationByUserAndName(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
defer cancel()
_, err := client.OrganizationByName(ctx, codersdk.Me, "nothing")
_, err := client.OrganizationByUserAndName(ctx, codersdk.Me, "nothing")
var apiErr *codersdk.Error
require.ErrorAs(t, err, &apiErr)
require.Equal(t, http.StatusNotFound, apiErr.StatusCode())
@ -85,7 +85,7 @@ func TestOrganizationByUserAndName(t *testing.T) {
Name: "another",
})
require.NoError(t, err)
_, err = other.OrganizationByName(ctx, codersdk.Me, org.Name)
_, err = other.OrganizationByUserAndName(ctx, codersdk.Me, org.Name)
var apiErr *codersdk.Error
require.ErrorAs(t, err, &apiErr)
require.Equal(t, http.StatusNotFound, apiErr.StatusCode())
@ -101,7 +101,7 @@ func TestOrganizationByUserAndName(t *testing.T) {
org, err := client.Organization(ctx, user.OrganizationID)
require.NoError(t, err)
_, err = client.OrganizationByName(ctx, codersdk.Me, org.Name)
_, err = client.OrganizationByUserAndName(ctx, codersdk.Me, org.Name)
require.NoError(t, err)
})
}