本文整理汇总了Python中models.Runs.json_by_ids方法的典型用法代码示例。如果您正苦于以下问题:Python Runs.json_by_ids方法的具体用法?Python Runs.json_by_ids怎么用?Python Runs.json_by_ids使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Runs
的用法示例。
在下文中一共展示了Runs.json_by_ids方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from models import Runs [as 别名]
# 或者: from models.Runs import json_by_ids [as 别名]
def get(self):
self.response.headers['Content-Type'] = 'application/json'
test_id, branch_id, platform_id = _get_test_branch_platform_ids(self)
runs = Runs.json_by_ids(branch_id, platform_id, test_id)
if runs:
self.response.out.write(runs)
elif model_from_numeric_id(branch_id, Branch) and model_from_numeric_id(platform_id, Platform) and model_from_numeric_id(test_id, Test):
schedule_runs_update(test_id, branch_id, platform_id)
示例2: test_json_by_ids
# 需要导入模块: from models import Runs [as 别名]
# 或者: from models.Runs import json_by_ids [as 别名]
def test_json_by_ids(self):
some_branch = Branch.create_if_possible('some-branch', 'Some Branch')
some_platform = Platform.create_if_possible('some-platform', 'Some Platform')
some_builder = Builder.get(Builder.create('some-builder', 'Some Builder'))
some_test = Test.update_or_insert('some-test', some_branch, some_platform)
self._create_results(some_branch, some_platform, some_builder, 'some-test', [50.0])
runs = Runs.update_or_insert(some_branch, some_platform, some_test)
runs_json = runs.to_json()
key_name = Runs._key_name(some_branch.id, some_platform.id, some_test.id)
self.assertEqual(Runs.json_by_ids(some_branch.id, some_platform.id, some_test.id), runs_json)
self.assertEqual(memcache.get(key_name), runs_json)
memcache.set(key_name, 'blah')
self.assertEqual(Runs.json_by_ids(some_branch.id, some_platform.id, some_test.id), 'blah')
memcache.delete(key_name)
self.assertEqual(Runs.json_by_ids(some_branch.id, some_platform.id, some_test.id), runs_json)
self.assertEqual(memcache.get(key_name), runs_json)