add show_grants_test for sql_parser
@@ -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;
@@ -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;
@@ -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;
