Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 0 additions & 2 deletions pkg/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"

"github.com/brevdev/brev-cli/pkg/auth"
"github.com/brevdev/brev-cli/pkg/cmd/approve"
"github.com/brevdev/brev-cli/pkg/cmd/autostop"
"github.com/brevdev/brev-cli/pkg/cmd/background"
"github.com/brevdev/brev-cli/pkg/cmd/bmon"
Expand Down Expand Up @@ -246,7 +245,6 @@ func createCmdTree(cmd *cobra.Command, t *terminal.Terminal, loginCmdStore *stor
if featureflag.IsDev() {
_ = 0 // noop
cmd.AddCommand(test.NewCmdTest(t, noLoginCmdStore))
cmd.AddCommand(approve.NewCmdApprove(t, loginCmdStore))
cmd.AddCommand(clipboard.EstablishConnection(t, loginCmdStore))
cmd.AddCommand(clipboard.SendToClipboard(t, loginCmdStore))
cmd.AddCommand(clipboard.ForwardPort(t, loginCmdStore))
Expand Down
19 changes: 0 additions & 19 deletions pkg/store/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,25 +111,6 @@ func (s AuthHTTPStore) UpdateUser(userID string, updatedUser *entity.UpdateUser)
var usersIDPathPattern = fmt.Sprintf("%s/%s", usersPath, "%s")

// usersIDPath = fmt.Sprintf(usersIDPathPattern, fmt.Sprintf("{%s}", userIDParamStr))
// usersApprovePathPattern = fmt.Sprintf("%s/approve", usersIDPathPattern)
// usersApprovePath = fmt.Sprintf(usersApprovePathPattern, userIDParamStr)

func (s AuthHTTPStore) ApproveUserByID(userID string) (*entity.User, error) {
var result entity.User
res, err := s.authHTTPClient.restyClient.R().
SetHeader("Content-Type", "application/json").
// SetPathParam(userIDParamName, userID).
SetResult(&result).
Post(usersPath + "/" + userID + "/approve")
if err != nil {
return nil, breverrors.WrapAndTrace(err)
}
if res.IsError() {
return nil, NewHTTPResponseError(res)
}

return &result, nil
}

func (s AuthHTTPStore) GetUsers(queryParams map[string]string) ([]entity.User, error) {
var result []entity.User
Expand Down
26 changes: 0 additions & 26 deletions pkg/store/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,29 +128,3 @@ func TestUpdateUser(t *testing.T) {
return
}
}

func TestApproveUser(t *testing.T) {
s := MakeMockAuthHTTPStore()
httpmock.ActivateNonDefault(s.authHTTPClient.restyClient.GetClient())

expected := &entity.User{
ID: "1",
}
res, err := httpmock.NewJsonResponder(200, expected)
if !assert.Nil(t, err) {
return
}
url := fmt.Sprintf("=~^%s/%s/%s/approve.+", s.authHTTPClient.restyClient.BaseURL, usersPath, expected.ID)
httpmock.RegisterResponder("POST", url, res)

u, err := s.ApproveUserByID(expected.ID)
if !assert.Nil(t, err) {
return
}
if !assert.NotNil(t, u) {
return
}
if !assert.Equal(t, expected, u) {
return
}
}
1 change: 1 addition & 0 deletions pkg/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ func runVsCodeCommand(vscodepath string, args []string) ([]byte, error) {
var commonVSCodePaths = []string{
"code",
"/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code",
"/mnt/c/Program Files/Microsoft VS Code/bin/code",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's this

"/usr/bin/code",
"/usr/local/bin/code",
"/snap/bin/code",
Expand Down