本文整理汇总了Python中pyramid.testing.DummyRequest.search_settings方法的典型用法代码示例。如果您正苦于以下问题:Python DummyRequest.search_settings方法的具体用法?Python DummyRequest.search_settings怎么用?Python DummyRequest.search_settings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyramid.testing.DummyRequest
的用法示例。
在下文中一共展示了DummyRequest.search_settings方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_people_profile_view
# 需要导入模块: from pyramid.testing import DummyRequest [as 别名]
# 或者: from pyramid.testing.DummyRequest import search_settings [as 别名]
def test_people_profile_view(self):
from notaliens.people.views import people_profile_view
request = DummyRequest()
request.method = 'GET'
request.db_session = mock.Mock()
request.matchdict = mock.MagicMock()
request.search_settings = {
'enabled': True
}
user = mock.Mock()
region = mock.Mock()
users = mock.MagicMock()
with mock.patch('notaliens.people.views.get_user_by_username') as get_user_by_username: # nopep8
with mock.patch('notaliens.people.views.get_region_by_postal') as get_region_by_postal: # nopep8
with mock.patch('notaliens.people.views.get_users') as get_users: # nopep8
get_user_by_username.return_value = user
get_region_by_postal.return_value = region
get_users.return_value = users
response = people_profile_view(request)
assert response['data']['user'] == user
示例2: test_people_index_base_get
# 需要导入模块: from pyramid.testing import DummyRequest [as 别名]
# 或者: from pyramid.testing.DummyRequest import search_settings [as 别名]
def test_people_index_base_get(self):
from notaliens.people.views import people_index
request = DummyRequest()
request.method = 'GET'
request.search_settings = {
'enabled': True
}
with mock.patch('notaliens.people.views.get_users') as get_users:
get_users.return_value = {
'count': 0
}
response = people_index(request)
assert response['data']['count'] == 0
assert response['data']['current_page'] == 0