mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
[fix] Fix style check
This commit is contained in:
parent
a7d693573b
commit
26cab169aa
@ -16,7 +16,6 @@ namespace DB
|
||||
namespace ErrorCodes
|
||||
{
|
||||
extern const int INVALID_GRANT;
|
||||
extern const int SYNTAX_ERROR;
|
||||
}
|
||||
|
||||
namespace
|
||||
|
@ -4,22 +4,18 @@ import logging
|
||||
import pytest
|
||||
from helpers.cluster import ClickHouseCluster
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def cluster():
|
||||
try:
|
||||
cluster = ClickHouseCluster(__file__)
|
||||
cluster.add_instance(
|
||||
"node1",
|
||||
user_configs=[
|
||||
"configs/users.xml"
|
||||
]
|
||||
)
|
||||
cluster.add_instance("node1", user_configs=["configs/users.xml"])
|
||||
|
||||
cluster.add_instance(
|
||||
"node2",
|
||||
user_configs=[
|
||||
"configs/users.xml",
|
||||
]
|
||||
],
|
||||
)
|
||||
logging.info("Starting cluster...")
|
||||
cluster.start()
|
||||
@ -37,24 +33,26 @@ def test_check_grant(cluster):
|
||||
node1.query("CREATE USER tuser")
|
||||
node1.query("GRANT SELECT ON tb TO tuser")
|
||||
# Has been granted but not table not exists
|
||||
res, _ = node1.query("CHECK GRANT SELECT ON tb", user = "tuser")
|
||||
res, _ = node1.query("CHECK GRANT SELECT ON tb", user="tuser")
|
||||
assert res == "0"
|
||||
|
||||
node1.query("CREATE TABLE tb (`content` UInt64) ENGINE = MergeTree ORDER BY content")
|
||||
node1.query(
|
||||
"CREATE TABLE tb (`content` UInt64) ENGINE = MergeTree ORDER BY content"
|
||||
)
|
||||
node1.query("INSERT INTO tb VALUES (1)")
|
||||
# Has been granted and table exists
|
||||
res, _ = node1.query("CHECK GRANT SELECT ON tb", user = "tuser")
|
||||
res, _ = node1.query("CHECK GRANT SELECT ON tb", user="tuser")
|
||||
assert res == "1"
|
||||
|
||||
node1.query("REVOKE SELECT ON tb FROM tuser")
|
||||
# Has not been granted but table exists
|
||||
res, _ = node1.query("CHECK GRANT SELECT ON tb", user = "tuser")
|
||||
res, _ = node1.query("CHECK GRANT SELECT ON tb", user="tuser")
|
||||
assert res == "0"
|
||||
|
||||
# Role
|
||||
node1.query("CREATE ROLE trole")
|
||||
node1.query("GRANT SELECT ON tb TO trole")
|
||||
node1.query("GRANT trole TO tuser")
|
||||
node1.query("SET ROLE trole", user = "tuser")
|
||||
res, _ = node1.query("CHECK GRANT SELECT ON tb", user = "tuser")
|
||||
node1.query("SET ROLE trole", user="tuser")
|
||||
res, _ = node1.query("CHECK GRANT SELECT ON tb", user="tuser")
|
||||
assert res == "1"
|
||||
|
Loading…
Reference in New Issue
Block a user