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


Python DummyRequest.errors方法代码示例

本文整理汇总了Python中pyramid.testing.DummyRequest.errors方法的典型用法代码示例。如果您正苦于以下问题:Python DummyRequest.errors方法的具体用法?Python DummyRequest.errors怎么用?Python DummyRequest.errors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyramid.testing.DummyRequest的用法示例。


在下文中一共展示了DummyRequest.errors方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_set_request_obsolete

# 需要导入模块: from pyramid.testing import DummyRequest [as 别名]
# 或者: from pyramid.testing.DummyRequest import errors [as 别名]
 def test_set_request_obsolete(self, publish):
     req = DummyRequest(user=DummyUser())
     req.errors = cornice.Errors()
     eq_(self.obj.status, UpdateStatus.pending)
     self.obj.set_request(self.db, UpdateRequest.obsolete, req.user.name)
     eq_(self.obj.status, UpdateStatus.obsolete)
     eq_(len(req.errors), 0)
     publish.assert_called_once_with(
         topic='update.request.obsolete', msg=mock.ANY)
开发者ID:cgwalters,项目名称:bodhi,代码行数:11,代码来源:test_models.py

示例2: test_set_request_untested_stable

# 需要导入模块: from pyramid.testing import DummyRequest [as 别名]
# 或者: from pyramid.testing.DummyRequest import errors [as 别名]
 def test_set_request_untested_stable(self):
     """
     Ensure that we can't submit an update for stable if it hasn't met the
     minimum testing requirements.
     """
     req = DummyRequest(user=DummyUser())
     req.errors = cornice.Errors()
     req.koji = buildsys.get_session()
     eq_(self.obj.status, UpdateStatus.pending)
     try:
         self.obj.set_request(self.db, UpdateRequest.stable, req.user.name)
         assert False
     except BodhiException, e:
         pass
开发者ID:cgwalters,项目名称:bodhi,代码行数:16,代码来源:test_models.py

示例3: test_set_request_stable_after_week_in_testing

# 需要导入模块: from pyramid.testing import DummyRequest [as 别名]
# 或者: from pyramid.testing.DummyRequest import errors [as 别名]
    def test_set_request_stable_after_week_in_testing(self, publish):
        req = DummyRequest()
        req.errors = cornice.Errors()
        req.koji = buildsys.get_session()
        req.user = model.User(name='bob')

        self.obj.status = UpdateStatus.testing
        self.obj.request = None

        # Pretend it's been in testing for a week
        self.obj.comment(
            self.db, u'This update has been pushed to testing.', author=u'bodhi')
        self.obj.date_testing = self.obj.comments[-1].timestamp - timedelta(days=7)
        eq_(self.obj.days_in_testing, 7)
        eq_(self.obj.meets_testing_requirements, True)

        self.obj.set_request(self.db, UpdateRequest.stable, req)
        eq_(self.obj.request, UpdateRequest.stable)
        eq_(len(req.errors), 0)
        publish.assert_called_once_with(
            topic='update.request.stable', msg=mock.ANY)
开发者ID:cgwalters,项目名称:bodhi,代码行数:23,代码来源:test_models.py

示例4: test_set_meets_then_met_requirements

# 需要导入模块: from pyramid.testing import DummyRequest [as 别名]
# 或者: from pyramid.testing.DummyRequest import errors [as 别名]
    def test_set_meets_then_met_requirements(self, publish):
        req = DummyRequest()
        req.errors = cornice.Errors()
        req.koji = buildsys.get_session()
        req.user = model.User(name='bob')

        self.obj.status = UpdateStatus.testing
        self.obj.request = None

        # Pretend it's been in testing for a week
        self.obj.comment(
            self.db, u'This update has been pushed to testing.', author=u'bodhi')
        self.obj.date_testing = self.obj.comments[-1].timestamp - timedelta(days=7)
        eq_(self.obj.days_in_testing, 7)
        eq_(self.obj.meets_testing_requirements, True)
        eq_(self.obj.met_testing_requirements, False)

        text = config.get('testing_approval_msg') % self.obj.days_in_testing
        self.obj.comment(self.db, text, author=u'bodhi')

        eq_(self.obj.meets_testing_requirements, True)
        eq_(self.obj.met_testing_requirements, True)
开发者ID:cgwalters,项目名称:bodhi,代码行数:24,代码来源:test_models.py

示例5: test_adds_body_error_if_json_invalid

# 需要导入模块: from pyramid.testing import DummyRequest [as 别名]
# 或者: from pyramid.testing.DummyRequest import errors [as 别名]
 def test_adds_body_error_if_json_invalid(self):
     request = DummyRequest()
     request.body = b'{wrong,"format"}'
     request.errors = Errors()
     validator(request, mock.Mock())
     self.assertEqual('body', request.errors[0]['location'])
开发者ID:leplatrem,项目名称:daybed,代码行数:8,代码来源:test_schemas_validators.py


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