MCPcopy Create free account
hub / github.com/dropbox/dbxcli / TestSharedLinkCreateRejectsEmptyPassword

Function TestSharedLinkCreateRejectsEmptyPassword

cmd/share_create_link_test.go:505–527  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

503}
504
505func TestSharedLinkCreateRejectsEmptyPassword(t *testing.T) {
506 called := false
507 stubSharedLinkClient(t, &mockSharedLinkClient{
508 createSharedLinkWithSettingsFn: func(arg *sharing.CreateSharedLinkWithSettingsArg) (sharing.IsSharedLinkMetadata, error) {
509 called = true
510 return nil, nil
511 },
512 })
513
514 cmd := &cobra.Command{}
515 addSharedLinkPasswordFlags(cmd)
516 if err := cmd.Flags().Set("password", ""); err != nil {
517 t.Fatalf("set password: %v", err)
518 }
519
520 err := shareLinkCreate(cmd, []string{"/file.txt"})
521 if err == nil || !strings.Contains(err.Error(), "shared link password cannot be empty") {
522 t.Fatalf("error = %v, want empty password error", err)
523 }
524 if called {
525 t.Fatal("CreateSharedLinkWithSettings should not be called")
526 }
527}
528
529func TestSharedLinkCreateWithAccessSetsAccess(t *testing.T) {
530 mock := &mockSharedLinkClient{

Callers

nothing calls this directly

Calls 4

stubSharedLinkClientFunction · 0.85
shareLinkCreateFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected