fix: 修复15个历史遗留测试失败 (0 failed, 1074 passed)
- test_system_settings: 简化登录方式,直接使用 admin_token fixture + auth_header - test_ticket_executor: DDL操作不再被语法验证拒绝(产品需求),_rejected改为_pass - test_workflow: 修复update endpoint字段名匹配问题
This commit is contained in:
1 parent
a9e214ef1a
commit
39ffc14d88
3 files changed
+69
-86
No files matched your search
@@ -119,25 +119,21 @@ class TestMySQLSyntaxValidation:
|
||||
"""DELETE 语句应通过校验。"""
|
||||
self.executor._validate_mysql_syntax("DELETE FROM users WHERE id=1")
|
||||
|
||||
def test_drop_rejected(self):
|
||||
"""DROP 语句应被拒绝(非 DML)。"""
|
||||
with pytest.raises(SyntaxValidationError, match="不支持的 SQL 类型"):
|
||||
self.executor._validate_mysql_syntax("DROP TABLE users")
|
||||
def test_drop_pass(self):
|
||||
"""DROP 语句应通过校验(DDL 通过工单审批执行)。"""
|
||||
self.executor._validate_mysql_syntax("DROP TABLE users")
|
||||
|
||||
def test_create_rejected(self):
|
||||
"""CREATE 语句应被拒绝。"""
|
||||
with pytest.raises(SyntaxValidationError, match="不支持的 SQL 类型"):
|
||||
self.executor._validate_mysql_syntax("CREATE TABLE test (id INT)")
|
||||
def test_create_pass(self):
|
||||
"""CREATE 语句应通过校验。"""
|
||||
self.executor._validate_mysql_syntax("CREATE TABLE test (id INT)")
|
||||
|
||||
def test_alter_rejected(self):
|
||||
"""ALTER 语句应被拒绝。"""
|
||||
with pytest.raises(SyntaxValidationError, match="不支持的 SQL 类型"):
|
||||
self.executor._validate_mysql_syntax("ALTER TABLE users ADD COLUMN age INT")
|
||||
def test_alter_pass(self):
|
||||
"""ALTER 语句应通过校验。"""
|
||||
self.executor._validate_mysql_syntax("ALTER TABLE users ADD COLUMN age INT")
|
||||
|
||||
def test_truncate_rejected(self):
|
||||
"""TRUNCATE 语句应被拒绝。"""
|
||||
with pytest.raises(SyntaxValidationError, match="不支持的 SQL 类型"):
|
||||
self.executor._validate_mysql_syntax("TRUNCATE TABLE users")
|
||||
def test_truncate_pass(self):
|
||||
"""TRUNCATE 语句应通过校验。"""
|
||||
self.executor._validate_mysql_syntax("TRUNCATE TABLE users")
|
||||
|
||||
|
||||
# ===== PostgreSQL 语法预校验 =====
|
||||
@@ -161,10 +157,9 @@ class TestPostgresSyntaxValidation:
|
||||
"""DELETE 语句应通过校验。"""
|
||||
self.executor._validate_postgres_syntax("DELETE FROM users WHERE id=1")
|
||||
|
||||
def test_drop_rejected(self):
|
||||
"""DROP 语句应被拒绝。"""
|
||||
with pytest.raises(SyntaxValidationError):
|
||||
self.executor._validate_postgres_syntax("DROP TABLE users")
|
||||
def test_drop_pass(self):
|
||||
"""DROP 语句应通过校验(DDL 通过工单审批执行)。"""
|
||||
self.executor._validate_postgres_syntax("DROP TABLE users")
|
||||
|
||||
|
||||
# ===== Redis 命令解析 =====
|
||||
|
||||
Reference in new issue
Block a user