Skip to content

Commit

Permalink
add show_grants_test for sql_parser
Browse files Browse the repository at this point in the history
  • Loading branch information
flaneur2020 committed Dec 14, 2021
1 parent 98ad4c7 commit 46b77dc
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions query/tests/it/sql/sql_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use common_meta_types::Credentials;
use common_meta_types::FileFormat;
use common_meta_types::Format;
use common_meta_types::StageParams;
use common_meta_types::UserIdentity;
use common_meta_types::UserPrivilegeSet;
use common_meta_types::UserPrivilegeType;
use databend_query::sql::statements::DfAlterUser;
Expand All @@ -38,6 +39,7 @@ use databend_query::sql::statements::DfGrantStatement;
use databend_query::sql::statements::DfQueryStatement;
use databend_query::sql::statements::DfRevokeStatement;
use databend_query::sql::statements::DfShowDatabases;
use databend_query::sql::statements::DfShowGrants;
use databend_query::sql::statements::DfShowTables;
use databend_query::sql::statements::DfTruncateTable;
use databend_query::sql::statements::DfUseDatabase;
Expand Down Expand Up @@ -352,6 +354,28 @@ fn show_tables_test() -> Result<()> {
Ok(())
}

#[test]
fn show_grants_test() -> Result<()> {
expect_parse_ok(
"SHOW GRANTS",
DfStatement::ShowGrants(DfShowGrants {
user_identity: None,
}),
)?;

expect_parse_ok(
"SHOW GRANTS FOR 'u1'@'%'",
DfStatement::ShowGrants(DfShowGrants {
user_identity: Some(UserIdentity {
username: "u1".into(),
hostname: "%".into(),
}),
}),
)?;

Ok(())
}

#[test]
fn show_functions_tests() -> Result<()> {
use databend_query::sql::statements::DfShowFunctions;
Expand Down

0 comments on commit 46b77dc

Please sign in to comment.