feat(cli): add error message for bad login URL (#4042)

This commit is contained in:
Joe Previte
2022-09-14 20:15:47 +00:00
committed by GitHub
parent 62d97b18f4
commit 22e49c4316
2 changed files with 11 additions and 1 deletions
+10
View File
@@ -2,6 +2,7 @@ package cli_test
import (
"context"
"fmt"
"testing"
"github.com/stretchr/testify/assert"
@@ -23,6 +24,15 @@ func TestLogin(t *testing.T) {
require.Error(t, err)
})
t.Run("InitialUserBadLoginURL", func(t *testing.T) {
t.Parallel()
badLoginURL := "https://fcca2077f06e68aaf9"
root, _ := clitest.New(t, "login", badLoginURL)
err := root.Execute()
errMsg := fmt.Sprintf("Failed to check server %q for first user, is the URL correct and is coder accessible from your browser?", badLoginURL)
require.ErrorContains(t, err, errMsg)
})
t.Run("InitialUserTTY", func(t *testing.T) {
t.Parallel()
client := coderdtest.New(t, nil)