gogcli/internal/cmd/gmail_delegates_test.go
salmonumbrella c04963b1ee
fix(security): guard risky filter/delegate/public-share actions (#317)
* 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>
2026-03-07 23:25:54 +00:00

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)
}
}