* fix(security): require confirmation for risky share/delegate/filter actions * fix(lint): resolve contacts lints and format execute tests * fix(security): guard risky share and delegate flows (#317) (thanks @salmonumbrella) --------- Co-authored-by: Peter Steinberger <steipete@gmail.com>
27 lines
788 B
Go
27 lines
788 B
Go
package cmd
|
|
|
|
import (
|
|
"context"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestDelegatesCommandsExist(t *testing.T) {
|
|
// Unit tests for the actual API calls live in integration; here we just ensure
|
|
// the commands exist and are properly structured. (Compile-time coverage.)
|
|
_ = GmailDelegatesCmd{}
|
|
_ = GmailDelegatesListCmd{}
|
|
_ = GmailDelegatesGetCmd{}
|
|
_ = GmailDelegatesAddCmd{}
|
|
_ = GmailDelegatesRemoveCmd{}
|
|
}
|
|
|
|
func TestGmailDelegatesAdd_NoInputRequiresForce(t *testing.T) {
|
|
flags := &RootFlags{Account: "a@b.com", NoInput: true}
|
|
cmd := &GmailDelegatesAddCmd{}
|
|
err := runKong(t, cmd, []string{"delegate@example.com"}, context.Background(), flags)
|
|
if err == nil || !strings.Contains(err.Error(), "refusing to add gmail delegate") {
|
|
t.Fatalf("expected refusing error, got %v", err)
|
|
}
|
|
}
|