Skip to content

Commit

Permalink
fix dict iter
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoQuote committed Aug 14, 2023
1 parent 9f6fc3c commit c9be485
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion sql/engines/test_cassandra.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def test_get_all_tables(self, mock_query):
def test_describe_table(self, mock_query):
mock_query.return_value = ResultSet()
self.engine.describe_table("some_db", "some_table")
mock_query.assert_called_once_with(db_name="some_db", sql="describe some_table")
mock_query.assert_called_once_with(db_name="some_db", sql="describe table some_table")

@patch("sql.engines.cassandra.CassandraEngine.query")
def test_get_all_columns_by_tb(self, mock_query):
Expand Down
2 changes: 1 addition & 1 deletion sql/templates/queryapplylist.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ <h4 class="modal-title" id="myModalLabel">申请数据库查询权限</h4>
title="请选择实例:"
data-live-search="true" required>
// TODO 使用models中的choices 渲染
{% for name, engine in engines %}
{% for name, engine in engines.items %}
<optgroup id="optgroup-{{ name }}" label="{{ engine.engine.name }}"></optgroup>
{% endfor %}
</select>
Expand Down
18 changes: 10 additions & 8 deletions sql/tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import re
import unittest
from datetime import timedelta, datetime, date
from unittest.mock import MagicMock, patch, ANY
from django.conf import settings
Expand Down Expand Up @@ -31,6 +32,7 @@
WorkflowAuditSetting,
ArchiveConfig,
)
from common.dashboard import ChartDao

User = Users

Expand Down Expand Up @@ -743,7 +745,7 @@ def test_query_priv_check_tb_priv_exist(self, __db_priv, __tb_priv, __table_ref)
@patch("sql.query_privileges._tb_priv", return_value=False)
@patch("sql.query_privileges._db_priv", return_value=False)
def test_query_priv_check_table_ref_Exception_and_no_db_priv(
self, __db_priv, __tb_priv, __table_ref
self, __db_priv, __tb_priv, __table_ref
):
"""
测试用户权限校验,mysql实例、普通用户 ,inception语法树抛出异常
Expand Down Expand Up @@ -2550,7 +2552,7 @@ def test_param_history(self):
@patch("sql.engines.mysql.MysqlEngine.get_variables")
@patch("sql.engines.get_engine")
def test_param_edit_variable_not_config(
self, _get_engine, _get_variables, _set_variable
self, _get_engine, _get_variables, _set_variable
):
"""
测试参数修改,参数未在模板配置
Expand All @@ -2570,7 +2572,7 @@ def test_param_edit_variable_not_config(
@patch("sql.engines.mysql.MysqlEngine.get_variables")
@patch("sql.engines.get_engine")
def test_param_edit_variable_not_change(
self, _get_engine, _get_variables, _set_variable
self, _get_engine, _get_variables, _set_variable
):
"""
测试参数修改,已在参数模板配置,但是值无变化
Expand Down Expand Up @@ -2600,7 +2602,7 @@ def test_param_edit_variable_not_change(
@patch("sql.engines.mysql.MysqlEngine.get_variables")
@patch("sql.engines.get_engine")
def test_param_edit_variable_change(
self, _get_engine, _get_variables, _set_variable
self, _get_engine, _get_variables, _set_variable
):
"""
测试参数修改,已在参数模板配置,且值有变化
Expand Down Expand Up @@ -2630,7 +2632,7 @@ def test_param_edit_variable_change(
@patch("sql.engines.mysql.MysqlEngine.get_variables")
@patch("sql.engines.get_engine")
def test_param_edit_variable_error(
self, _get_engine, _get_variables, _set_variable
self, _get_engine, _get_variables, _set_variable
):
"""
测试参数修改,已在参数模板配置,修改抛错
Expand Down Expand Up @@ -2835,7 +2837,7 @@ def test_notify_for_sqlreview_audit_abort(self, _auth_group_users, _msg_sender):
@patch("sql.notify.MsgSender")
@patch("sql.notify.auth_group_users")
def test_notify_for_sqlreview_wrong_workflow_type(
self, _auth_group_users, _msg_sender
self, _auth_group_users, _msg_sender
):
"""
测试不存在的工单类型
Expand All @@ -2855,7 +2857,7 @@ def test_notify_for_sqlreview_wrong_workflow_type(
@patch("sql.notify.MsgSender")
@patch("sql.notify.auth_group_users")
def test_notify_for_query_audit_wait_apply_db_perm(
self, _auth_group_users, _msg_sender
self, _auth_group_users, _msg_sender
):
"""
测试查询申请库权限
Expand All @@ -2881,7 +2883,7 @@ def test_notify_for_query_audit_wait_apply_db_perm(
@patch("sql.notify.MsgSender")
@patch("sql.notify.auth_group_users")
def test_notify_for_query_audit_wait_apply_tb_perm(
self, _auth_group_users, _msg_sender
self, _auth_group_users, _msg_sender
):
"""
测试查询申请表权限
Expand Down

0 comments on commit c9be485

Please sign in to comment.