本文整理汇总了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)])
示例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')
示例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})
示例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))
示例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')
示例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)
示例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)
示例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)
示例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')
示例10: setUp
def setUp(self):
super(TestLoginHandler, self).setUp()
self.list_url = get_absolute_url(list_url('login'), api_name='account')
示例11: url
def url(self, app):
return get_absolute_url(get_url('app', pk=app.pk), absolute=False)
示例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)
示例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, [])
示例14: setUp
def setUp(self):
super(TestAppDetail, self).setUp()
self.url = get_absolute_url(get_url('app', pk=337141),
api_name='fireplace')
示例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')