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


Python test_oauth.get_absolute_url函数代码示例

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


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

示例1: 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

示例2: test_get_slug

 def test_get_slug(self):
     Webapp.objects.get(pk=337141).update(app_slug='foo')
     res = self.client.get(get_absolute_url(('api_dispatch_detail',
         {'resource_name': 'app', 'app_slug': 'foo'}),
         api_name='fireplace'))
     data = json.loads(res.content)
     eq_(data['id'], '337141')
开发者ID:almosteverywhere,项目名称:zamboni,代码行数:7,代码来源:test_api.py

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: test_get_payment_account

 def test_get_payment_account(self, client):
     client.api.bango.package().get.return_value = {"full": payment_data}
     app = self.create_app()
     app.premium_type = amo.ADDON_PREMIUM
     app.save()
     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)
     AddonPaymentAccount.objects.create(
         addon=app, payment_account=acct, set_price=1,
         product_uri="/path/to/app/")
     p = Price.objects.create(price='1.07')
     AddonPremium.objects.create(addon=app, price=p)
     acct_url = get_absolute_url(get_url('account', acct.pk),
                                 'payments', False)
     res = self.client.get(self.get_url)
     eq_(res.status_code, 200)
     data = json.loads(res.content)
     eq_(data['payment_account'], acct_url)
     eq_(data['price'], '1.07')
开发者ID:markgif,项目名称:zamboni,代码行数:21,代码来源:test_handlers.py

示例10: setUp

 def setUp(self):
     super(TestLoginHandler, self).setUp()
     self.list_url = get_absolute_url(list_url('login'), api_name='account')
开发者ID:KryDos,项目名称:zamboni,代码行数:3,代码来源:test_api.py

示例11: url

 def url(self, app):
     return get_absolute_url(get_url('app', pk=app.pk), absolute=False)
开发者ID:at13,项目名称:zamboni,代码行数:2,代码来源:test_api_payments.py

示例12: setUp

 def setUp(self):
     super(TestPaymentAccount, self).setUp()
     AccountCase.setUp(self)
     self.payment_url = get_absolute_url(
         get_url('account', pk=self.account.pk),
         api_name='payments', absolute=False)
开发者ID:at13,项目名称:zamboni,代码行数:6,代码来源:test_api_payments.py

示例13: test_others

 def test_others(self):
     url = get_absolute_url(list_url('app'), api_name='fireplace')
     self._allowed_verbs(self.url, ['get'])
     self._allowed_verbs(url, [])
开发者ID:almosteverywhere,项目名称:zamboni,代码行数:4,代码来源:test_api.py

示例14: setUp

 def setUp(self):
     super(TestAppDetail, self).setUp()
     self.url = get_absolute_url(get_url('app', pk=337141),
                                 api_name='fireplace')
开发者ID:almosteverywhere,项目名称:zamboni,代码行数:4,代码来源:test_api.py

示例15: setUp

 def setUp(self):
     super(TestLoginHandler, self).setUp()
     self.list_url = get_absolute_url(list_url('login'), api_name='account')
     self.create_switch('browserid-login')
开发者ID:sandy-slin,项目名称:zamboni,代码行数:4,代码来源:test_api.py


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