本文整理汇总了Python中avocado.models.DataQuery.session方法的典型用法代码示例。如果您正苦于以下问题:Python DataQuery.session方法的具体用法?Python DataQuery.session怎么用?Python DataQuery.session使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类avocado.models.DataQuery
的用法示例。
在下文中一共展示了DataQuery.session方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_session
# 需要导入模块: from avocado.models import DataQuery [as 别名]
# 或者: from avocado.models.DataQuery import session [as 别名]
def test_get_session(self):
query = DataQuery(user=self.user, name='Query', session=True)
query.save()
# All results for session query.
response = self.client.get('/api/queries/session/results/',
HTTP_ACCEPT='application/json')
self.assertEqual(response.status_code, codes.ok)
self.assertTrue(response.content)
# Single page of results for session query.
response = self.client.get('/api/queries/session/results/3/',
HTTP_ACCEPT='application/json')
self.assertEqual(response.status_code, codes.ok)
self.assertTrue(response.content)
# Page range of results for session query.
response = self.client.get('/api/queries/session/results/1...5/',
HTTP_ACCEPT='application/json')
self.assertEqual(response.status_code, codes.ok)
self.assertTrue(response.content)
query.session = False
query.save()
response = self.client.get('/api/queries/session/',
HTTP_ACCEPT='application/json')
self.assertEqual(response.status_code, codes.not_found)
示例2: test_get_session
# 需要导入模块: from avocado.models import DataQuery [as 别名]
# 或者: from avocado.models.DataQuery import session [as 别名]
def test_get_session(self):
query = DataQuery(user=self.user, name='Query', session=True)
query.save()
response = self.client.get('/api/queries/session/',
HTTP_ACCEPT='application/json')
self.assertEqual(response.status_code, codes.ok)
self.assertTrue(response.content)
query.session = False
query.save()
response = self.client.get('/api/queries/session/',
HTTP_ACCEPT='application/json')
self.assertEqual(response.status_code, codes.not_found)