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

Function TestInitDbxValidatesOutputBeforeAuth

cmd/root_test.go:317–333  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

315}
316
317func TestInitDbxValidatesOutputBeforeAuth(t *testing.T) {
318 t.Setenv(envAccessToken, "")
319 t.Setenv(envAuthFile, filepath.Join(t.TempDir(), "missing-auth.json"))
320
321 cmd := newAuthTestCommand()
322 if err := cmd.Root().PersistentFlags().Set(outputFlag, "yaml"); err != nil {
323 t.Fatal(err)
324 }
325
326 err := initDbx(cmd, nil)
327 if err == nil {
328 t.Fatal("expected invalid output format to fail")
329 }
330 if !strings.Contains(err.Error(), `unsupported output format "yaml"`) {
331 t.Fatalf("error = %q, want output format error", err.Error())
332 }
333}
334
335func TestInitDbxRejectsUnsupportedStructuredOutputBeforeAuth(t *testing.T) {
336 t.Setenv(envAccessToken, "")

Callers

nothing calls this directly

Calls 3

newAuthTestCommandFunction · 0.85
initDbxFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected