mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
feat: implement 'is_default' org field (#12142)
The first organization created is now marked as "default". This is to allow "single org" behavior as we move to a multi org codebase. It is intentional that the user cannot change the default org at this stage. Only 1 default org can exist, and it is always the first org. Closes: https://github.com/coder/coder/issues/11961
This commit is contained in:
@ -24,6 +24,14 @@ func TestOrganizationsByUser(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, orgs)
|
||||
require.Len(t, orgs, 1)
|
||||
require.True(t, orgs[0].IsDefault, "first org is always default")
|
||||
|
||||
// Make an extra org, and it should not be defaulted.
|
||||
notDefault, err := client.CreateOrganization(ctx, codersdk.CreateOrganizationRequest{
|
||||
Name: "another",
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.False(t, notDefault.IsDefault, "only 1 default org allowed")
|
||||
}
|
||||
|
||||
func TestOrganizationByUserAndName(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user