• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python mkt.set_user函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mkt.set_user函数的典型用法代码示例。如果您正苦于以下问题:Python set_user函数的具体用法?Python set_user怎么用?Python set_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: setUp

 def setUp(self):
     self.addon = Webapp.objects.get(pk=337141)
     self.dest = os.path.join(settings.TMP_PATH, 'preview')
     self.user = UserProfile.objects.get(pk=999)
     mkt.set_user(self.user)
     if not os.path.exists(self.dest):
         os.makedirs(self.dest)
开发者ID:ujdhesa,项目名称:zamboni,代码行数:7,代码来源:test_forms.py


示例2: test_rejected

    def test_rejected(self):
        comments = "oh no you di'nt!!"
        mkt.set_user(UserProfile.objects.get(email='[email protected]'))
        mkt.log(mkt.LOG.REJECT_VERSION, self.webapp,
                self.webapp.current_version, user_id=999,
                details={'comments': comments, 'reviewtype': 'pending'})
        self.webapp.update(status=mkt.STATUS_REJECTED)
        make_rated(self.webapp)
        (self.webapp.versions.latest()
                             .all_files[0].update(status=mkt.STATUS_REJECTED))

        r = self.client.get(self.url)
        eq_(r.status_code, 200)
        doc = pq(r.content)('#version-status')
        eq_(doc('.status-rejected').length, 1)
        eq_(doc('#rejection').length, 1)
        eq_(doc('#rejection blockquote').text(), comments)

        my_reply = 'fixed just for u, brah'
        r = self.client.post(self.url, {'notes': my_reply,
                                        'resubmit-app': ''})
        self.assert3xx(r, self.url, 302)

        webapp = self.get_webapp()
        eq_(webapp.status, mkt.STATUS_PENDING,
            'Reapplied apps should get marked as pending')
        eq_(webapp.versions.latest().all_files[0].status, mkt.STATUS_PENDING,
            'Files for reapplied apps should get marked as pending')
        action = mkt.LOG.WEBAPP_RESUBMIT
        assert AppLog.objects.filter(
            addon=webapp, activity_log__action=action.id).exists(), (
                "Didn't find `%s` action in logs." % action.short)
开发者ID:pkdevboxy,项目名称:zamboni,代码行数:32,代码来源:test_views_versions.py


示例3: test_rereview_flag_adult

    def test_rereview_flag_adult(self):
        mkt.set_user(user_factory())
        app = app_factory()

        app.set_content_ratings({
            mkt.ratingsbodies.ESRB: mkt.ratingsbodies.ESRB_E,
            mkt.ratingsbodies.CLASSIND: mkt.ratingsbodies.CLASSIND_18,
        })
        _flag_rereview_adult(app, mkt.ratingsbodies.ESRB,
                             mkt.ratingsbodies.ESRB_T)
        assert not app.rereviewqueue_set.count()
        assert not ActivityLog.objects.filter(
            action=mkt.LOG.CONTENT_RATING_TO_ADULT.id).exists()

        # Adult should get flagged to rereview.
        _flag_rereview_adult(app, mkt.ratingsbodies.ESRB,
                             mkt.ratingsbodies.ESRB_A)
        eq_(app.rereviewqueue_set.count(), 1)
        eq_(ActivityLog.objects.filter(
            action=mkt.LOG.CONTENT_RATING_TO_ADULT.id).count(), 1)

        # Test things same same if rating stays the same as adult.
        app.set_content_ratings({
            mkt.ratingsbodies.ESRB: mkt.ratingsbodies.ESRB_A,
        })
        _flag_rereview_adult(app, mkt.ratingsbodies.ESRB,
                             mkt.ratingsbodies.ESRB_A)
        eq_(app.rereviewqueue_set.count(), 1)
        eq_(ActivityLog.objects.filter(
            action=mkt.LOG.CONTENT_RATING_TO_ADULT.id).count(), 1)
开发者ID:shahbaz17,项目名称:zamboni,代码行数:30,代码来源:test_cron.py


示例4: wrapper

 def wrapper(*args, **kw):
     old_user = get_user()
     set_user(get_task_user())
     try:
         result = f(*args, **kw)
     finally:
         set_user(old_user)
     return result
开发者ID:atiqueahmedziad,项目名称:zamboni,代码行数:8,代码来源:decorators.py


示例5: process_request

    def process_request(self, request):
        """Attach authentication/permission helpers to request."""
        request.check_ownership = partial(acl.check_ownership, request)

        # figure out our list of groups...
        if request.user.is_authenticated():
            mkt.set_user(request.user)
            request.groups = request.user.groups.all()
开发者ID:Fjoerfoks,项目名称:zamboni,代码行数:8,代码来源:middleware.py


示例6: setUp

 def setUp(self):
     self.user = user_factory(email="porkbelly")
     mkt.set_user(self.user)
     self.profile = self.user
     self.addon = Webapp.objects.get()
     self.version = self.addon.latest_version
     self.thread = self._thread_factory()
     self.note = self._note_factory(self.thread)
     self.attachment1, self.attachment2 = self._attachments(self.note)
开发者ID:elysium001,项目名称:zamboni,代码行数:9,代码来源:test_models.py


示例7: test_set_task_user

    def test_set_task_user(self):
        @set_task_user
        def some_func():
            return get_user()

        set_user(UserProfile.objects.get(email='[email protected]'))
        eq_(get_user().pk, 999)
        eq_(some_func().pk, int(settings.TASK_USER_ID))
        eq_(get_user().pk, 999)
开发者ID:Fjoerfoks,项目名称:zamboni,代码行数:9,代码来源:test_decorators.py


示例8: test_comm_thread_after_resubmission

 def test_comm_thread_after_resubmission(self):
     self.webapp.update(status=mkt.STATUS_REJECTED)
     make_rated(self.webapp)
     mkt.set_user(UserProfile.objects.get(email='[email protected]'))
     (self.webapp.versions.latest()
                          .all_files[0].update(status=mkt.STATUS_REJECTED))
     my_reply = 'no give up'
     self.client.post(self.url, {'notes': my_reply,
                                 'resubmit-app': ''})
     notes = CommunicationNote.objects.all()
     eq_(notes.count(), 1)
     eq_(notes[0].body, my_reply)
开发者ID:pkdevboxy,项目名称:zamboni,代码行数:12,代码来源:test_views_versions.py


示例9: test_processing

    def test_processing(self):
        """
        The mock client always returns the same data. Set up the app so it
        matches the submission ID and verify the data is saved as expected.
        """
        mkt.set_user(user_factory())
        app = app_factory()
        IARCInfo.objects.create(webapp=app, submission_id=52,
                                security_code='FZ32CU8')
        app.set_descriptors([
            'has_classind_violence',
            'has_esrb_strong_lang',
            'has_pegi_language', 'has_pegi_online',
            'has_usk_lang',
        ])
        app.set_interactives([])
        app.set_content_ratings({
            mkt.ratingsbodies.CLASSIND: mkt.ratingsbodies.CLASSIND_L
        })

        process_iarc_changes()
        app = app.reload()

        # Check ratings. CLASSIND should get updated.
        cr = app.content_ratings.get(
            ratings_body=mkt.ratingsbodies.CLASSIND.id)
        eq_(cr.rating, mkt.ratingsbodies.CLASSIND_14.id)
        cr = app.content_ratings.get(ratings_body=mkt.ratingsbodies.ESRB.id)
        eq_(cr.rating, mkt.ratingsbodies.ESRB_M.id)

        assert ActivityLog.objects.filter(
            action=mkt.LOG.CONTENT_RATING_CHANGED.id).count()

        # Check descriptors.
        rd = RatingDescriptors.objects.get(webapp=app)
        self.assertSetEqual(rd.to_keys(), [
            'has_esrb_strong_lang',
            'has_classind_lang',
            'has_pegi_lang', 'has_pegi_online',
            'has_usk_lang',
        ])

        # Check interactives.
        ri = RatingInteractives.objects.get(webapp=app)
        self.assertSetEqual(ri.to_keys(), [
            'has_shares_info', 'has_shares_location', 'has_digital_purchases',
            'has_users_interact'
        ])
开发者ID:shahbaz17,项目名称:zamboni,代码行数:48,代码来源:test_cron.py


示例10: test_rejected_packaged

    def test_rejected_packaged(self):
        self.webapp.update(is_packaged=True)
        comments = "oh no you di'nt!!"
        mkt.set_user(UserProfile.objects.get(email='[email protected]'))
        mkt.log(mkt.LOG.REJECT_VERSION, self.webapp,
                self.webapp.current_version, user_id=999,
                details={'comments': comments, 'reviewtype': 'pending'})
        self.webapp.update(status=mkt.STATUS_REJECTED)
        (self.webapp.versions.latest()
                             .all_files[0].update(status=mkt.STATUS_REJECTED))

        r = self.client.get(self.url)
        eq_(r.status_code, 200)
        doc = pq(r.content)('#version-status')
        eq_(doc('.status-rejected').length, 1)
        eq_(doc('#rejection').length, 1)
        eq_(doc('#rejection blockquote').text(), comments)
开发者ID:pkdevboxy,项目名称:zamboni,代码行数:17,代码来源:test_views_versions.py


示例11: setUp

    def setUp(self):
        super(TestAccountListForm, self).setUp()
        self.addon = Webapp.objects.get(pk=337141)
        self.addon.update(status=mkt.STATUS_NULL,
                          highest_status=mkt.STATUS_PUBLIC)
        self.provider = get_provider(name='bango')
        self.price = Price.objects.filter()[0]
        AddonPremium.objects.create(addon=self.addon, price=self.price)

        self.user = UserProfile.objects.get(pk=31337)
        mkt.set_user(self.user)

        self.other = UserProfile.objects.get(pk=999)
        self.admin = UserProfile.objects.get(email='[email protected]')

        self.kwargs = {
            'addon': self.addon,
            'provider': self.provider,
        }
开发者ID:Fjoerfoks,项目名称:zamboni,代码行数:19,代码来源:test_forms_payments.py


示例12: _post_teardown

 def _post_teardown(self):
     mkt.set_user(None)
     clean_translations(None)  # Make sure queued translations are removed.
     super(TestCase, self)._post_teardown()
开发者ID:Witia1,项目名称:zamboni,代码行数:4,代码来源:__init__.py


示例13: setUp

 def setUp(self):
     now = datetime.now()
     bom = datetime(now.year, now.month, 1)
     self.lm = bom - timedelta(days=1)
     self.user = UserProfile.objects.filter()[0]
     mkt.set_user(self.user)
开发者ID:shahbaz17,项目名称:zamboni,代码行数:6,代码来源:test_models.py


示例14: process_response

 def process_response(self, request, response):
     mkt.set_user(None)
     return response
开发者ID:Fjoerfoks,项目名称:zamboni,代码行数:3,代码来源:middleware.py


示例15: setUp

 def setUp(self):
     mkt.set_user(UserProfile.objects.all()[0])
     self.form = forms.AppFeaturesForm()
     self.app = Webapp.objects.get(pk=337141)
     self.features = self.app.current_version.features
开发者ID:digideskio,项目名称:zamboni,代码行数:5,代码来源:test_forms.py


示例16: process_exception

 def process_exception(self, request, exception):
     mkt.set_user(None)
开发者ID:Fjoerfoks,项目名称:zamboni,代码行数:2,代码来源:middleware.py


示例17: tearDown

 def tearDown(self):
     mkt.set_user(None)
开发者ID:clouserw,项目名称:zamboni,代码行数:2,代码来源:test_models.py


示例18: setUp

 def setUp(self):
     mkt.set_user(user_factory())
开发者ID:Fjoerfoks,项目名称:zamboni,代码行数:2,代码来源:test_log.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python acl.action_allowed函数代码示例发布时间:2022-05-27
下一篇:
Python mkt.log函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap