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

Python base.get_url函数代码示例

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

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



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

示例1: test_put_no_upsold_for_free

 def test_put_no_upsold_for_free(self):
     free_webapp = tempfile.NamedTemporaryFile('w', suffix='.webapp').name
     self.manifest_copy_over(free_webapp, 'mozball-nice-slug.webapp')
     free_app = self.create_app(free_webapp)
     free_data = self.base_data()
     free_data['name'] = 'mozball free'
     self.client.put(get_url('app', free_app.pk), data=json.dumps(free_data))
     app = self.create_app()
     data = self.base_data()
     data['upsold'] = get_absolute_url(get_url('app', free_app.pk),
                                       absolute=False)
     res = self.client.put(self.get_url, data=json.dumps(data))
     eq_(res.status_code, 400)
开发者ID:mitramichaeljade,项目名称:zamboni,代码行数:13,代码来源:test_handlers.py


示例2: test_get_timestamps

 def test_get_timestamps(self):
     fmt = '%Y-%m-%dT%H:%M:%S'
     rev = Review.objects.create(addon=self.app, user=self.user, body='yes')
     res = self.client.get(get_url('rating', rev.pk))
     data = json.loads(res.content)
     self.assertCloseToNow(datetime.strptime(data['modified'], fmt))
     self.assertCloseToNow(datetime.strptime(data['created'], fmt))
开发者ID:kmaglione,项目名称:zamboni,代码行数:7,代码来源:test_resources.py


示例3: test_install

 def test_install(self):
     ins = Installed.objects.create(user=self.user, addon_id=337141)
     res = self.client.get(self.get_url)
     eq_(res.status_code, 200, res.content)
     data = json.loads(res.content)
     eq_(data['installed'],
         [get_absolute_url(get_url('app', ins.addon.pk), absolute=False)])
开发者ID:almet,项目名称:zamboni,代码行数:7,代码来源:test_api.py


示例4: setUp

 def setUp(self):
     self.app = app_factory()
     self.app_url = get_url('app', self.app.pk)
     self.version = self.app.current_version
     self.file = self.version.all_files[0]
     self.request = RequestFactory()
     super(TestVersionStatusViewSet, self).setUp()
开发者ID:shahbaz17,项目名称:zamboni,代码行数:7,代码来源:test_views.py


示例5: test_only_put_by_owner

 def test_only_put_by_owner(self, client):
     app2 = app_factory(premium_type=amo.ADDON_FREE_INAPP)
     AddonUser.objects.create(addon=app2, user=self.other)
     acct = setup_payment_account(app2, self.other).payment_account
     r = self.client.put(get_url('account', acct.pk),
                         data=json.dumps(package_data))
     eq_(r.status_code, 404)
开发者ID:magopian,项目名称:zamboni,代码行数:7,代码来源:test_api.py


示例6: test_delete_users_admin

 def test_delete_users_admin(self):
     user2 = UserProfile.objects.get(pk=31337)
     r = Review.objects.create(addon=self.app, user=user2, body='yes')
     self.grant_permission(self.user, 'Users:Edit')
     res = self.client.delete(get_url('rating', r.pk))
     eq_(res.status_code, 204)
     eq_(Review.objects.count(), 0)
开发者ID:jvillalobos,项目名称:zamboni,代码行数:7,代码来源:test_resources.py


示例7: test_delete

    def test_delete(self, client):
        rdel = self.client.delete(get_url('account', self.account.pk))
        eq_(rdel.status_code, 204)

        client.api.bango.package().get.return_value = {"full": payment_data}
        rget = self.client.get(list_url('account'))
        eq_(json.loads(rget.content)['objects'], [])
开发者ID:KryDos,项目名称:zamboni,代码行数:7,代码来源:test_api.py


示例8: test_get_upsold

 def test_get_upsold(self):
     free = Webapp.objects.create(status=amo.STATUS_PUBLIC)
     AddonUpsell.objects.create(premium_id=337141, free=free)
     res = self.client.get(self.get_url)
     eq_(res.json['upsold'],
         self.client.get_absolute_url(get_url('app', pk=free.pk),
                                      absolute=False))
开发者ID:at13,项目名称:zamboni,代码行数:7,代码来源:test_handlers.py


示例9: test_delete_app_mine

 def test_delete_app_mine(self):
     AddonUser.objects.filter(addon=self.app).update(user=self.user)
     user2 = UserProfile.objects.get(pk=31337)
     r = Review.objects.create(addon=self.app, user=user2, body='yes')
     res = self.client.delete(get_url('rating', r.pk))
     eq_(res.status_code, 204)
     eq_(Review.objects.count(), 0)
开发者ID:jvillalobos,项目名称:zamboni,代码行数:7,代码来源:test_resources.py


示例10: test_put_upsold

 def test_put_upsold(self):
     free_webapp = tempfile.NamedTemporaryFile('w', suffix='.webapp').name
     self.manifest_copy_over(free_webapp, 'mozball-nice-slug.webapp')
     free_app = self.create_app(free_webapp)
     free_data = self.base_data()
     free_data['name'] = 'mozball free'
     self.client.put(get_url('app', free_app.pk), data=json.dumps(free_data))
     app = self.create_app()
     data = self.base_data()
     Price.objects.create(price='3.14')
     data['premium_type'] = 'premium'
     data['price'] = '3.14'
     data['upsold'] = get_absolute_url(get_url('app', free_app.pk),
                                       absolute=False)
     res = self.client.put(self.get_url, data=json.dumps(data))
     eq_(res.status_code, 202)
     eq_(app.upsold.free, free_app)
开发者ID:mitramichaeljade,项目名称:zamboni,代码行数:17,代码来源:test_handlers.py


示例11: other

 def other(self, shared=False):
     other_account = PaymentAccount.objects.create(user_id=31337,
         solitude_seller=self.seller, bango_package_id=123,
         seller_uri='seller_uri', uri='uri', shared=shared)
     other_url = get_absolute_url(
         get_url('account', pk=other_account.pk),
         api_name='payments', absolute=False)
     return self.data(overrides={'payment_account': other_url})
开发者ID:chusiang,项目名称:zamboni,代码行数:8,代码来源:test_api_payments.py


示例12: test_lang

    def test_lang(self):
        app = app_factory(description={'fr': 'Le blah', 'en-US': 'Blah'})
        url = get_url('app', app.pk)

        res = self.client.get(url, HTTP_ACCEPT_LANGUAGE='en-US')
        eq_(json.loads(res.content)['description'], 'Blah')

        res = self.client.get(url, HTTP_ACCEPT_LANGUAGE='fr')
        eq_(json.loads(res.content)['description'], 'Le blah')
开发者ID:at13,项目名称:zamboni,代码行数:9,代码来源:test_handlers.py


示例13: test_get

    def test_get(self, client):
        client.api.bango.package().get.return_value = {"full": payment_data}

        r = self.client.get(get_url('account', self.account.pk))
        eq_(r.status_code, 200)
        data = json.loads(r.content)
        pkg = package_data.copy()
        pkg['resource_uri'] = '/api/v1/payments/account/%s/' % self.account.pk
        eq_(data, pkg)
开发者ID:magopian,项目名称:zamboni,代码行数:9,代码来源:test_api.py


示例14: test_put

 def test_put(self, client):
     addr = '[email protected]'
     newpkg = package_data.copy()
     newpkg['adminEmailAddress'] = addr
     r = self.client.put(get_url('account', self.account.pk),
                         data=json.dumps(newpkg))
     eq_(r.status_code, 204)
     d = client.api.by_url().patch.call_args[1]['data']
     eq_(d['adminEmailAddress'], addr)
开发者ID:magopian,项目名称:zamboni,代码行数:9,代码来源:test_api.py


示例15: setUp

    def setUp(self):
        super(TestPrices, self).setUp(api_name='webpay')
        self.price = Price.objects.create(name='1', price=Decimal(1))
        self.currency = self.make_currency(3, self.price, 'CAD')
        self.list_url = list_url('prices')
        self.get_url = get_url('prices', self.price.pk)

        # If regions change, this will blow up.
        assert regions.BR.default_currency == 'BRL'
开发者ID:MikeLing,项目名称:zamboni,代码行数:9,代码来源:test_resources.py


示例16: test_some

    def test_some(self):
        self.add_perms()

        # This feels rather brittle.
        cache.set("%s:review_viewing:%s" % (settings.CACHE_PREFIX, 337141), 2519, 50 * 2)
        AppsReviewing(self.req).add(337141)

        res = self.client.get(self.list_url)
        data = json.loads(res.content)
        eq_(data["objects"][0]["resource_uri"], get_absolute_url(get_url("app", "337141"), absolute=False))
开发者ID:pombredanne,项目名称:zamboni,代码行数:10,代码来源:test_api.py


示例17: test_put_bogus_payment_account

 def test_put_bogus_payment_account(self):
     app = self.create_app()
     data = self.base_data()
     Price.objects.create(price='1.07')
     data['price'] = "1.07"
     data['premium_type'] = 'premium'
     data['payment_account'] = get_absolute_url(get_url('account', 999),
                                                'payments', False)
     res = self.client.put(self.get_url, data=json.dumps(data))
     eq_(res.status_code, 400)
     assert not hasattr(app, 'app_payment_account')
开发者ID:markgif,项目名称:zamboni,代码行数:11,代码来源:test_handlers.py


示例18: test_upsell

 def test_upsell(self):
     app = self.create_app()
     upsell = app_factory()
     AddonUpsell.objects.create(free=app, premium=upsell)
     res = self.client.get(self.get_url)
     eq_(res.status_code, 200)
     obj = json.loads(res.content)['upsell']
     eq_(obj['id'], upsell.id)
     eq_(obj['app_slug'], upsell.app_slug)
     eq_(obj['name'], upsell.name)
     eq_(obj['icon_url'], upsell.get_icon_url(128))
     eq_(obj['resource_uri'], self.client.get_absolute_url(get_url('app', pk=upsell.id), absolute=False))
开发者ID:at13,项目名称:zamboni,代码行数:12,代码来源:test_handlers.py


示例19: test_put_payment_account_on_free

 def test_put_payment_account_on_free(self, client):
     client.api.bango.package().get.return_value = {"full": payment_data}
     self.create_app()
     data = self.base_data()
     seller = SolitudeSeller.objects.create(user=self.profile, uuid='uid')
     acct = PaymentAccount.objects.create(
         user=self.profile, solitude_seller=seller, agreed_tos=True,
         seller_uri='uri', uri='uri', bango_package_id=123)
     data['payment_account'] = get_absolute_url(get_url('account', acct.pk),
                                                'payments', False)
     res = self.client.put(self.get_url, data=json.dumps(data))
     eq_(res.status_code, 400)
开发者ID:markgif,项目名称:zamboni,代码行数:12,代码来源:test_handlers.py


示例20: _update

    def _update(self, updated_data):
        # Create the original review
        default_data = {
            'body': 'Rocking the free web.',
            'rating': 5
        }
        res, res_data = self._create(default_data)

        # Update the review
        default_data.update(updated_data)
        review = Review.objects.all()[0]
        json_data = json.dumps(default_data)
        res = self.client.put(get_url('rating', review.pk), data=json_data)
        try:
            res_data = json.loads(res.content)
        except ValueError:
            res_data = res.content
        return res, res_data
开发者ID:jvillalobos,项目名称:zamboni,代码行数:18,代码来源:test_resources.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python base.http_error函数代码示例发布时间:2022-05-27
下一篇:
Python utils.purchase_list函数代码示例发布时间: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