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