本文整理汇总了Python中mkt.developers.tests.test_views_payments.setup_payment_account函数的典型用法代码示例。如果您正苦于以下问题:Python setup_payment_account函数的具体用法?Python setup_payment_account怎么用?Python setup_payment_account使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setup_payment_account函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_list
def test_get_list(self, client):
client.api.bango.package().get.return_value = {"full": payment_data}
app2 = app_factory(premium_type=amo.ADDON_FREE_INAPP)
AddonUser.objects.create(addon=app2, user=self.other)
setup_payment_account(app2, self.other)
r = self.client.get(list_url('account'))
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['objects'], [pkg])
示例2: 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)
示例3: test_bank_not_required
def test_bank_not_required(self):
"""When an account is specified, don't require bank details."""
payment = setup_payment_account(self.app, self.user).payment_account
form = forms_payments.BangoPaymentAccountForm(self.data, account=payment)
assert form.is_valid(), form.errors
del self.data["bankName"]
form = forms_payments.BangoPaymentAccountForm(self.data, account=payment)
assert form.is_valid(), form.errors # Still valid, even now.
示例4: setUp
def setUp(self):
BaseOAuth.setUp(self, api_name='payments')
self.app = Addon.objects.get(pk=337141)
self.app.update(premium_type=amo.ADDON_FREE_INAPP)
self.other = UserProfile.objects.get(pk=999)
AddonUser.objects.create(addon=self.app, user=self.profile)
self.account = setup_payment_account(self.app, self.profile,
uid='uid2').payment_account
self.account.name = 'account'
self.account.save()
示例5: test_on_save
def test_on_save(self):
"""Save should just trigger the account's update function."""
payment = setup_payment_account(self.app, self.user).payment_account
form = forms_payments.BangoPaymentAccountForm(self.data, account=payment)
assert form.is_valid(), form.errors
form.cleaned_data = {"account_name": "foo", "name": "bob"}
form.save()
payment = payment.reload()
eq_(payment.name, "foo")
self.bango_patcher.api.by_url.assert_called_with("uid")
示例6: setUp
def setUp(self):
super(TestBangoRedirect, self).setUp()
self.user = UserProfile.objects.get(username='31337') # steamcube
self.steamcube = Webapp.objects.get(pk=337141)
self.otherapp = app_factory(app_slug='otherapp')
self.reg_user = UserProfile.objects.get(email='[email protected]')
self.summary_url = reverse('lookup.user_summary', args=[self.user.pk])
self.login(UserProfile.objects.get(username='support_staff'))
self.steamcube.update(premium_type=amo.ADDON_PREMIUM)
self.account = setup_payment_account(self.steamcube, self.user)
self.portal_url = reverse('lookup.bango_portal_from_package',
args=[self.account.payment_account.account_id])
self.authentication_token = u'D0A44686-D4A3-4B2F-9BEB-5E4975E35192'