本文整理汇总了Python中explorer.tests.factories.SimpleQueryFactory.headers_and_data方法的典型用法代码示例。如果您正苦于以下问题:Python SimpleQueryFactory.headers_and_data方法的具体用法?Python SimpleQueryFactory.headers_and_data怎么用?Python SimpleQueryFactory.headers_and_data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类explorer.tests.factories.SimpleQueryFactory
的用法示例。
在下文中一共展示了SimpleQueryFactory.headers_and_data方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_blacklist_prevents_bad_sql_from_executing
# 需要导入模块: from explorer.tests.factories import SimpleQueryFactory [as 别名]
# 或者: from explorer.tests.factories.SimpleQueryFactory import headers_and_data [as 别名]
def test_blacklist_prevents_bad_sql_from_executing(self):
q = SimpleQueryFactory(sql='select 1 "delete";')
headers, data, duration, error = q.headers_and_data()
self.assertEqual(error, MSG_FAILED_BLACKLIST)
示例2: test_blacklist_check_runs_before_execution
# 需要导入模块: from explorer.tests.factories import SimpleQueryFactory [as 别名]
# 或者: from explorer.tests.factories.SimpleQueryFactory import headers_and_data [as 别名]
def test_blacklist_check_runs_before_execution(self):
q = SimpleQueryFactory(sql='select 1;')
with AssertMethodIsCalled(q, "passes_blacklist"):
headers, data, duration, error = q.headers_and_data()
示例3: test_blacklist_prevents_bad_sql_with_params_from_executing
# 需要导入模块: from explorer.tests.factories import SimpleQueryFactory [as 别名]
# 或者: from explorer.tests.factories.SimpleQueryFactory import headers_and_data [as 别名]
def test_blacklist_prevents_bad_sql_with_params_from_executing(self):
q = SimpleQueryFactory(sql="select '$$foo$$';")
q.params = {"foo": "'; delete from *; select'"}
res = q.headers_and_data()
self.assertEqual(res.error, MSG_FAILED_BLACKLIST)