Skip to content

feat: delete API token in /logout API #1770

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
May 27, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor cli
  • Loading branch information
AbhineetJain committed May 27, 2022
commit c38a0f50be23b368c3b70f203d53947015fe7d3a
25 changes: 12 additions & 13 deletions cli/logout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,18 @@ func TestLogout(t *testing.T) {
err = os.Chmod(string(config), 0500)
require.NoError(t, err)
}
t.Cleanup(func() {
// Setting the permissions back for cleanup.
if runtime.GOOS == "windows" {
err = os.Chmod(string(config.URL()), 0600)
require.NoError(t, err)
err = os.Chmod(string(config.Session()), 0600)
require.NoError(t, err)
} else {
err = os.Chmod(string(config), 0700)
require.NoError(t, err)
}
})

logoutChan := make(chan struct{})
logout, _ := clitest.New(t, "logout", "--global-config", string(config))
Expand All @@ -164,19 +176,6 @@ func TestLogout(t *testing.T) {
pty.ExpectMatch("Are you sure you want to logout?")
pty.WriteLine("yes")
<-logoutChan

t.Cleanup(func() {
// Setting the permissions back for cleanup.
if runtime.GOOS == "windows" {
err = os.Chmod(string(config.URL()), 0600)
require.NoError(t, err)
err = os.Chmod(string(config.Session()), 0600)
require.NoError(t, err)
} else {
err = os.Chmod(string(config), 0700)
require.NoError(t, err)
}
})
})
}

Expand Down