Skip to content

Commit

Permalink
added tests for SHOW GRANTS FOR statements
Browse files Browse the repository at this point in the history
  • Loading branch information
dgolja committed May 29, 2015
1 parent 8bfcda6 commit cdbfad8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions cmd/influxd/server_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1621,6 +1621,11 @@ func runTestsData(t *testing.T, testName string, nodes Cluster, database, retent
query: `GRANT READ ON %DB% TO jdoe`,
expected: `{"results":[{}]}`,
},
{
name: "show DB privileges for user",
query: `SHOW GRANTS FOR jdoe`,
expected: `{"results":[{"series":[{"columns":["database","privilege"],"values":[["%DB%","READ"]]}]}]}`,
},
{
query: `REVOKE ALL PRIVILEGES FROM jdoe`,
expected: `{"results":[{}]}`,
Expand Down
10 changes: 9 additions & 1 deletion influxql/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,12 @@ func TestParser_ParseStatement(t *testing.T) {
stmt: &influxql.ShowServersStatement{},
},

// SHOW GRANTS
{
s: `SHOW GRANTS FOR jdoe`,
stmt: &influxql.ShowGrantsForUserStatement{Name: "jdoe"},
},

// SHOW DATABASES
{
s: `SHOW DATABASES`,
Expand Down Expand Up @@ -1219,8 +1225,10 @@ func TestParser_ParseStatement(t *testing.T) {
{s: `SHOW CONTINUOUS`, err: `found EOF, expected QUERIES at line 1, char 17`},
{s: `SHOW RETENTION`, err: `found EOF, expected POLICIES at line 1, char 16`},
{s: `SHOW RETENTION POLICIES`, err: `found EOF, expected identifier at line 1, char 25`},
{s: `SHOW FOO`, err: `found FOO, expected CONTINUOUS, DATABASES, FIELD, MEASUREMENTS, RETENTION, SERIES, SERVERS, TAG, USERS at line 1, char 6`},
{s: `SHOW FOO`, err: `found FOO, expected CONTINUOUS, DATABASES, FIELD, GRANTS, MEASUREMENTS, RETENTION, SERIES, SERVERS, TAG, USERS at line 1, char 6`},
{s: `SHOW STATS ON`, err: `found EOF, expected string at line 1, char 15`},
{s: `SHOW GRANTS`, err: `found EOF, expected FOR at line 1, char 13`},
{s: `SHOW GRANTS FOR`, err: `found EOF, expected identifier at line 1, char 17`},
{s: `DROP CONTINUOUS`, err: `found EOF, expected QUERY at line 1, char 17`},
{s: `DROP CONTINUOUS QUERY`, err: `found EOF, expected identifier at line 1, char 23`},
{s: `DROP CONTINUOUS QUERY myquery`, err: `found EOF, expected ON at line 1, char 31`},
Expand Down

0 comments on commit cdbfad8

Please sign in to comment.