本文整理汇总了Python中models.Test.get_by_key_name方法的典型用法代码示例。如果您正苦于以下问题:Python Test.get_by_key_name方法的具体用法?Python Test.get_by_key_name怎么用?Python Test.get_by_key_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Test
的用法示例。
在下文中一共展示了Test.get_by_key_name方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from models import Test [as 别名]
# 或者: from models.Test import get_by_key_name [as 别名]
def post(self):
self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'
try:
payload = json.loads(self.request.body)
hide = payload['hide']
except:
self.response.out.write("Failed to parse the payload: %s" % self.request.body)
return
if 'platform' in payload:
model = Platform.get_by_key_name(payload['platform'])
elif 'test' in payload:
model = Test.get_by_key_name(payload['test'])
else:
self.response.out.write('Not supported')
return
if not model:
self.response.out.write('Could not find the model')
return
model.hidden = hide
model.put()
schedule_dashboard_update()
schedule_manifest_update()
self.response.out.write('OK')
示例2: test_value_with_hidden_platform_and_tesst
# 需要导入模块: from models import Test [as 别名]
# 或者: from models.Test import get_by_key_name [as 别名]
def test_value_with_hidden_platform_and_tesst(self):
webkit_trunk = Branch.create_if_possible('webkit-trunk', 'WebKit trunk')
some_platform = Platform.create_if_possible('some-platform', 'Some Platform')
hidden_platform = Platform.create_if_possible('hidden-platform', 'Hidden Platform')
hidden_platform.hidden = True
hidden_platform.put()
Test.update_or_insert('some-test', webkit_trunk, some_platform)
Test.update_or_insert('some-test', webkit_trunk, hidden_platform)
Test.update_or_insert('other-test', webkit_trunk, some_platform)
Test.update_or_insert('other-test', webkit_trunk, hidden_platform)
Test.update_or_insert('hidden-test', webkit_trunk, some_platform)
Test.update_or_insert('hidden-test', webkit_trunk, hidden_platform)
hidden_test = Test.get_by_key_name('hidden-test')
hidden_test.hidden = True
hidden_test.put()
self.assertEqual(DashboardJSONGenerator().value()['platformToId'], {'Some Platform': some_platform.id})
self.assertEqual(DashboardJSONGenerator().value()['testToId'],
{'some-test': Test.get_by_key_name('some-test').id, 'other-test': Test.get_by_key_name('other-test').id})
示例3: execute
# 需要导入模块: from models import Test [as 别名]
# 或者: from models.Test import get_by_key_name [as 别名]
def execute(id):
test = Test.get_by_key_name(testName)
returnValue = None
if not test:
test = Test(id=id, name=testName, key_name=testName)
returnValue = test
if branch.key() not in test.branches:
test.branches.append(branch.key())
if platform.key() not in test.platforms:
test.platforms.append(platform.key())
test.put()
return returnValue
示例4: test_value_two_platforms
# 需要导入模块: from models import Test [as 别名]
# 或者: from models.Test import get_by_key_name [as 别名]
def test_value_two_platforms(self):
webkit_trunk = Branch.create_if_possible('webkit-trunk', 'WebKit trunk')
some_platform = Platform.create_if_possible('some-platform', 'Some Platform')
other_platform = Platform.create_if_possible('other-platform', 'Other Platform')
Test.update_or_insert('some-test', webkit_trunk, some_platform)
Test.update_or_insert('some-test', webkit_trunk, other_platform)
self.assertEqual(DashboardJSONGenerator().value(), {
'defaultBranch': 'WebKit trunk',
'branchToId': {'WebKit trunk': webkit_trunk.id},
'platformToId': {'Some Platform': some_platform.id, 'Other Platform': other_platform.id},
'testToId': {'some-test': Test.get_by_key_name('some-test').id},
})
示例5: post
# 需要导入模块: from models import Test [as 别名]
# 或者: from models.Test import get_by_key_name [as 别名]
def post(self):
self.response.headers['Content-Type'] = 'text/plain; charset=utf-8';
merge = Test.get_by_key_name(self.request.get('merge'))
into = Test.get_by_key_name(self.request.get('into'))
if not merge or not into:
self.response.out.write('Invalid test names')
return
mergedResults = TestResult.all()
mergedResults.filter('name =', merge.name)
for result in mergedResults:
result.name = into.name
result.put()
# Just flush everyting since we rarely merge tests and we need to flush
# dashboard, manifest, and all runs for this test here.
memcache.flush_all()
deleteModelWithNumericIdHolder(merge)
self.response.out.write('OK')
示例6: _addTestIfNeeded
# 需要导入模块: from models import Test [as 别名]
# 或者: from models.Test import get_by_key_name [as 别名]
def _addTestIfNeeded(self, testName, branch, platform):
def execute(id):
test = Test.get_by_key_name(testName)
returnValue = None
if not test:
test = Test(id=id, name=testName, key_name=testName)
returnValue = test
if branch.key() not in test.branches:
test.branches.append(branch.key())
if platform.key() not in test.platforms:
test.platforms.append(platform.key())
test.put()
return returnValue
return createInTransactionWithNumericIdHolder(execute) or Test.get_by_key_name(testName)
示例7: _add_test_if_needed
# 需要导入模块: from models import Test [as 别名]
# 或者: from models.Test import get_by_key_name [as 别名]
def _add_test_if_needed(self, test_name, branch, platform):
def execute(id):
test = Test.get_by_key_name(test_name)
returnValue = None
if not test:
test = Test(id=id, name=test_name, key_name=test_name)
returnValue = test
if branch.key() not in test.branches:
test.branches.append(branch.key())
if platform.key() not in test.platforms:
test.platforms.append(platform.key())
test.put()
return returnValue
return create_in_transaction_with_numeric_id_holder(execute) or Test.get_by_key_name(test_name)