|
| 1 | +package cli_test |
| 2 | + |
| 3 | +import ( |
| 4 | + "testing" |
| 5 | + |
| 6 | + "github.com/coder/coder/v2/cli/clitest" |
| 7 | + "github.com/coder/coder/v2/coderd/coderdtest" |
| 8 | + "github.com/coder/coder/v2/coderd/database" |
| 9 | + "github.com/coder/coder/v2/coderd/database/dbfake" |
| 10 | + "github.com/coder/coder/v2/testutil" |
| 11 | + "github.com/stretchr/testify/assert" |
| 12 | +) |
| 13 | + |
| 14 | +func TestSharingShare(t *testing.T) { |
| 15 | + t.Parallel() |
| 16 | + |
| 17 | + t.Run("ShareWithUser+Simple", func(t *testing.T) { |
| 18 | + t.Parallel() |
| 19 | + |
| 20 | + var ( |
| 21 | + client, db = coderdtest.NewWithDatabase(t, nil) |
| 22 | + orgOwner = coderdtest.CreateFirstUser(t, client) |
| 23 | + workspaceOwnerClient, workspaceOwner = coderdtest.CreateAnotherUser(t, client, orgOwner.OrganizationID) |
| 24 | + _, toShareWithUser = coderdtest.CreateAnotherUser(t, client, orgOwner.OrganizationID) |
| 25 | + workspace = dbfake.WorkspaceBuild(t, db, database.WorkspaceTable{ |
| 26 | + OwnerID: workspaceOwner.ID, |
| 27 | + OrganizationID: orgOwner.OrganizationID, |
| 28 | + }).Do().Workspace |
| 29 | + ) |
| 30 | + |
| 31 | + var _ = testutil.Context(t, testutil.WaitMedium) |
| 32 | + var _, root = clitest.New(t, "sharing", "share", workspace.Name, "--user", toShareWithUser.Username) |
| 33 | + clitest.SetupConfig(t, workspaceOwnerClient, root) |
| 34 | + |
| 35 | + // TODO: Test output of the command |
| 36 | + |
| 37 | + // TODO: Test updated ACL |
| 38 | + |
| 39 | + assert.Equal(t, 1, 0) |
| 40 | + }) |
| 41 | +} |
0 commit comments