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

Commitd3d5e1e

Browse files
committed
update tests that were failing due to login error message changes
Signed-off-by: Callum Styan <callumstyan@gmail.com>
1 parent730b5dd commitd3d5e1e

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

‎cli/logout_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cli_test
22

33
import (
4+
"fmt"
45
"os"
56
"runtime"
67
"testing"
@@ -90,9 +91,13 @@ func TestLogout(t *testing.T) {
9091
logout.Stdout=pty.Output()
9192

9293
gofunc() {
94+
executable,err:=os.Executable()
95+
require.NoError(t,err)
96+
require.NotEqual(t,"",executable)
97+
9398
deferclose(logoutChan)
94-
err:=logout.Run()
95-
assert.ErrorContains(t,err,"You are not logged in.Try logging in using 'coder login <url>'.")
99+
err=logout.Run()
100+
require.Contains(t,err.Error(),fmt.Sprintf("Try logging in using '%s login <url>'.",executable))
96101
}()
97102

98103
<-logoutChan

‎cli/userlist_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import (
44
"bytes"
55
"context"
66
"encoding/json"
7+
"fmt"
8+
"os"
79
"testing"
810

911
"github.com/stretchr/testify/assert"
@@ -69,9 +71,12 @@ func TestUserList(t *testing.T) {
6971
t.Run("NoURLFileErrorHasHelperText",func(t*testing.T) {
7072
t.Parallel()
7173

74+
executable,err:=os.Executable()
75+
require.NoError(t,err)
76+
7277
inv,_:=clitest.New(t,"users","list")
73-
err:=inv.Run()
74-
require.Contains(t,err.Error(),"Try logging in using 'coder login <url>'.")
78+
err=inv.Run()
79+
require.Contains(t,err.Error(),fmt.Sprintf("Try logging in using '%s login <url>'.",executable))
7580
})
7681
t.Run("SessionAuthErrorHasHelperText",func(t*testing.T) {
7782
t.Parallel()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp