mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
test: batch 03 of refactoring CLI tests not to use PTY (#25935)
Part of [coder/internal#1400](https://github.com/coder/internal/issues/1400) Batch of refactored CLI tests to avoid creating PTYs.
This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/coder/coder/v2/cli/clitest"
|
||||
"github.com/coder/coder/v2/pty/ptytest"
|
||||
)
|
||||
|
||||
func TestTemplateInit(t *testing.T) {
|
||||
@@ -16,7 +15,6 @@ func TestTemplateInit(t *testing.T) {
|
||||
t.Parallel()
|
||||
tempDir := t.TempDir()
|
||||
inv, _ := clitest.New(t, "templates", "init", tempDir)
|
||||
ptytest.New(t).Attach(inv)
|
||||
clitest.Run(t, inv)
|
||||
files, err := os.ReadDir(tempDir)
|
||||
require.NoError(t, err)
|
||||
@@ -27,7 +25,6 @@ func TestTemplateInit(t *testing.T) {
|
||||
t.Parallel()
|
||||
tempDir := t.TempDir()
|
||||
inv, _ := clitest.New(t, "templates", "init", "--id", "docker", tempDir)
|
||||
ptytest.New(t).Attach(inv)
|
||||
clitest.Run(t, inv)
|
||||
files, err := os.ReadDir(tempDir)
|
||||
require.NoError(t, err)
|
||||
@@ -38,7 +35,6 @@ func TestTemplateInit(t *testing.T) {
|
||||
t.Parallel()
|
||||
tempDir := t.TempDir()
|
||||
inv, _ := clitest.New(t, "templates", "init", "--id", "thistemplatedoesnotexist", tempDir)
|
||||
ptytest.New(t).Attach(inv)
|
||||
err := inv.Run()
|
||||
require.ErrorContains(t, err, "invalid choice: thistemplatedoesnotexist, should be one of")
|
||||
files, err := os.ReadDir(tempDir)
|
||||
|
||||
Reference in New Issue
Block a user