cmd_test.go 721 B

12345678910111213141516171819202122232425262728
  1. package dbconnect
  2. import (
  3. "testing"
  4. "github.com/stretchr/testify/assert"
  5. "github.com/urfave/cli/v2"
  6. )
  7. func TestCmd(t *testing.T) {
  8. tests := [][]string{
  9. {"cloudflared", "db-connect", "--playground"},
  10. {"cloudflared", "db-connect", "--playground", "--hostname", "sql.mysite.com"},
  11. {"cloudflared", "db-connect", "--url", "sqlite3::memory:?cache=shared", "--insecure"},
  12. {"cloudflared", "db-connect", "--url", "sqlite3::memory:?cache=shared", "--hostname", "sql.mysite.com", "--auth-domain", "mysite.cloudflareaccess.com", "--application-aud", "aud"},
  13. }
  14. app := &cli.App{
  15. Name: "cloudflared",
  16. Commands: []*cli.Command{Cmd()},
  17. }
  18. for _, test := range tests {
  19. assert.NoError(t, app.Run(test))
  20. }
  21. }