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

Function TestShareLinkRevokeJSONOutputsRevokedURL

cmd/share_link_json_test.go:277–299  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

275}
276
277func TestShareLinkRevokeJSONOutputsRevokedURL(t *testing.T) {
278 stubSharedLinkClient(t, &mockSharedLinkClient{
279 revokeSharedLinkFn: func(arg *sharing.RevokeSharedLinkArg) error {
280 return nil
281 },
282 })
283
284 var stdout bytes.Buffer
285 cmd := newShareLinkRevokeTestCommand(&stdout, nil)
286 setShareLinkOutputJSON(t, cmd)
287
288 if err := shareLinkRevoke(cmd, []string{"https://example.com/report"}); err != nil {
289 t.Fatalf("shareLinkRevoke error: %v", err)
290 }
291
292 got := decodeShareLinkOperationOutput[shareLinkRevokeInput, shareLinkRevokeResult](t, stdout.Bytes())
293 if got.Input.URL != "https://example.com/report" {
294 t.Fatalf("input.url = %q, want revoked URL", got.Input.URL)
295 }
296 if len(got.Results) != 1 || got.Results[0].Status != shareLinkJSONStatusRevoked || got.Results[0].Kind != shareLinkJSONKindSharedLink || got.Results[0].Result.URL != "https://example.com/report" {
297 t.Fatalf("results = %#v, want revoked URL", got.Results)
298 }
299}
300
301func TestShareLinkDownloadJSONOutputsTargetAndMetadata(t *testing.T) {
302 tmp := t.TempDir()

Callers

nothing calls this directly

Calls 5

stubSharedLinkClientFunction · 0.85
setShareLinkOutputJSONFunction · 0.85
shareLinkRevokeFunction · 0.85

Tested by

no test coverage detected