本文整理汇总了Python中models.Branch.create_if_possible方法的典型用法代码示例。如果您正苦于以下问题:Python Branch.create_if_possible方法的具体用法?Python Branch.create_if_possible怎么用?Python Branch.create_if_possible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Branch
的用法示例。
在下文中一共展示了Branch.create_if_possible方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_value_with_hidden_platform_and_tesst
# 需要导入模块: from models import Branch [as 别名]
# 或者: from models.Branch import create_if_possible [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})
示例2: test_value_with_hidden_platform_and_test
# 需要导入模块: from models import Branch [as 别名]
# 或者: from models.Branch import create_if_possible [as 别名]
def test_value_with_hidden_platform_and_test(self):
some_branch = Branch.create_if_possible('some-branch', 'Some Branch')
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', some_branch, some_platform)
some_test = Test.update_or_insert('some-test', some_branch, hidden_platform)
Test.update_or_insert('hidden-test', some_branch, some_platform)
hidden_test = Test.update_or_insert('hidden-test', some_branch, hidden_platform)
hidden_test.hidden = True
hidden_test.put()
value = ManifestJSONGenerator().value()
expected_test_ids = []
self.assertEqualUnorderedList(value.keys(), ['branchMap', 'platformMap', 'testMap'])
self.assertEqual(value['branchMap'],
{some_branch.id: {'name': some_branch.name, 'testIds': [some_test.id], 'platformIds': [some_platform.id]}})
self.assertEqual(value['platformMap'],
{some_platform.id: {'name': some_platform.name, 'branchIds': [some_branch.id], 'testIds': [some_test.id]}})
self.assertEqual(value['testMap'],
{some_test.id: {'name': some_test.name, 'branchIds': [some_branch.id], 'platformIds': [some_platform.id]}})