当前位置: 首页>>代码示例>>Python>>正文


Python DummyRequest.search_settings方法代码示例

本文整理汇总了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
开发者ID:einSelbst,项目名称:notaliens.com,代码行数:28,代码来源:test_people_views.py

示例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
开发者ID:dobrite,项目名称:notaliens.com,代码行数:21,代码来源:test_people_views.py


注:本文中的pyramid.testing.DummyRequest.search_settings方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。