Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit25d60f0

Browse files
committed
Add unit test for org flag
1 parenta69748c commit25d60f0

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

‎cli/organization_test.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,35 @@ func TestCurrentOrganization(t *testing.T) {
4242
require.NoError(t,<-errC)
4343
pty.ExpectMatch(first.OrganizationID.String())
4444
})
45+
46+
t.Run("UsingFlag",func(t*testing.T) {
47+
t.Parallel()
48+
ownerClient:=coderdtest.New(t,nil)
49+
first:=coderdtest.CreateFirstUser(t,ownerClient)
50+
// Owner is required to make orgs
51+
client,_:=coderdtest.CreateAnotherUser(t,ownerClient,first.OrganizationID,rbac.RoleOwner())
52+
53+
ctx:=testutil.Context(t,testutil.WaitMedium)
54+
orgs:=map[string]codersdk.Organization{
55+
"foo": {},
56+
"bar": {},
57+
}
58+
fororgName:=rangeorgs {
59+
org,err:=client.CreateOrganization(ctx, codersdk.CreateOrganizationRequest{
60+
Name:orgName,
61+
})
62+
require.NoError(t,err)
63+
orgs[orgName]=org
64+
}
65+
66+
inv,root:=clitest.New(t,"organizations","current","--only-id","-z=bar")
67+
clitest.SetupConfig(t,client,root)
68+
pty:=ptytest.New(t).Attach(inv)
69+
errC:=make(chanerror)
70+
gofunc() {
71+
errC<-inv.Run()
72+
}()
73+
require.NoError(t,<-errC)
74+
pty.ExpectMatch(orgs["bar"].ID.String())
75+
})
4576
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp