当前位置: 首页>>代码示例>>Python>>正文


Python Test.get_by_key_name方法代码示例

本文整理汇总了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')
开发者ID:EQ4,项目名称:h5vcc,代码行数:30,代码来源:admin_handlers.py

示例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})
开发者ID:EQ4,项目名称:h5vcc,代码行数:20,代码来源:json_generators_unittest.py

示例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
开发者ID:,项目名称:,代码行数:14,代码来源:

示例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},
     })
开发者ID:,项目名称:,代码行数:14,代码来源:

示例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')
开发者ID:,项目名称:,代码行数:24,代码来源:

示例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)
开发者ID:,项目名称:,代码行数:17,代码来源:

示例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)
开发者ID:sohocoke,项目名称:webkit,代码行数:17,代码来源:report_handler.py


注:本文中的models.Test.get_by_key_name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。