本文整理汇总了Python中test_utils.RequestFactory.MOBILE方法的典型用法代码示例。如果您正苦于以下问题:Python RequestFactory.MOBILE方法的具体用法?Python RequestFactory.MOBILE怎么用?Python RequestFactory.MOBILE使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类test_utils.RequestFactory
的用法示例。
在下文中一共展示了RequestFactory.MOBILE方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_packaged_hidden_on_android
# 需要导入模块: from test_utils import RequestFactory [as 别名]
# 或者: from test_utils.RequestFactory import MOBILE [as 别名]
def test_packaged_hidden_on_android(self, _filter_search_mock):
self.webapp.update(is_packaged=True)
self.refresh()
request = RequestFactory().get(reverse('search.search'))
request.GAIA = False
request.MOBILE = True
request.TABLET = False
_app_search(request)
req, qs, query = _filter_search_mock.call_args[0]
eq_(list(qs), [])
eq_(query['device'], 'mobile')
示例2: test_packaged_visible_on_gaia
# 需要导入模块: from test_utils import RequestFactory [as 别名]
# 或者: from test_utils.RequestFactory import MOBILE [as 别名]
def test_packaged_visible_on_gaia(self, _filter_search_mock):
raise SkipTest # disable until #789977 gets clarified
self.webapp.update(is_packaged=True)
self.refresh()
request = RequestFactory().get(reverse('search.search'))
request.GAIA = True
request.MOBILE = True
request.TABLET = False
_app_search(request)
req, qs, query = _filter_search_mock.call_args[0]
eq_(list(qs), [self.webapp])
eq_(query['device'], 'gaia')
示例3: test_xmobile
# 需要导入模块: from test_utils import RequestFactory [as 别名]
# 或者: from test_utils.RequestFactory import MOBILE [as 别名]
def test_xmobile(self):
rf = RequestFactory().get('/robots.txt')
for state in [True, False]:
rf.MOBILE = state
DeviceDetectionMiddleware().process_request(rf)
eq_(rf.MOBILE, state)