fix up imports and some tests
This commit is contained in:
Родитель
5a23e80b06
Коммит
7c9973ed18
|
@ -17,6 +17,7 @@ import amo
|
|||
import amo.tests
|
||||
from amo.urlresolvers import reverse
|
||||
from addons.models import AddonPremium, AddonUser
|
||||
from devhub.models import ActivityLog
|
||||
from market.models import PreApprovalUser, Price, PriceCurrency
|
||||
import paypal
|
||||
from reviews.models import Review
|
||||
|
@ -25,7 +26,6 @@ from users.models import UserNotification, UserProfile
|
|||
from versions.models import Version
|
||||
import users.notifications as email
|
||||
|
||||
from mkt.developers.models import ActivityLog
|
||||
from mkt.site.fixtures import fixture
|
||||
from mkt.webapps.models import Installed, Webapp
|
||||
|
||||
|
|
|
@ -279,7 +279,7 @@ class AddonPaymentAccount(CurlingHelper, amo.models.ModelBase):
|
|||
|
||||
if self.provider == 'bango':
|
||||
# Get the Bango number for this product.
|
||||
res = client.get_product_bango(data=self.product_uri)
|
||||
res = client.api.bango.product.get_object(data=self.product_uri)
|
||||
bango_number = res['bango']
|
||||
|
||||
AddonPaymentAccount._push_bango_premium(
|
||||
|
@ -315,7 +315,7 @@ class UserInappKey(CurlingHelper, amo.models.ModelBase):
|
|||
@classmethod
|
||||
def create(cls, user):
|
||||
sel = SolitudeSeller.create(user)
|
||||
prod = client.api.generic.product.post_product(data={
|
||||
prod = client.api.generic.product.post(data={
|
||||
'seller': sel.resource_uri, 'secret': generate_key(48),
|
||||
'external_id': str(uuid.uuid4()), 'public_id': str(uuid.uuid4())
|
||||
})
|
||||
|
|
|
@ -103,7 +103,7 @@ class TestPaymentAccount(amo.tests.TestCase):
|
|||
|
||||
def test_create_bango(self):
|
||||
# Return a seller object without hitting Bango.
|
||||
self.client.post_package.return_value = {
|
||||
self.client.api.bango.package.post.return_value = {
|
||||
'resource_uri': 'zipzap',
|
||||
'package_id': 123,
|
||||
}
|
||||
|
@ -116,11 +116,11 @@ class TestPaymentAccount(amo.tests.TestCase):
|
|||
eq_(res.bango_package_id, 123)
|
||||
eq_(res.uri, 'zipzap')
|
||||
|
||||
self.client.post_package.assert_called_with(
|
||||
self.client.api.bango.package.post.assert_called_with(
|
||||
data={'paypalEmailAddress': 'nobody@example.com',
|
||||
'seller': 'selleruri'})
|
||||
|
||||
self.client.post_bank_details.assert_called_with(
|
||||
self.client.api.bango.bank.post.assert_called_with(
|
||||
data={'seller_bango': 'zipzap'})
|
||||
|
||||
def test_cancel(self):
|
||||
|
@ -199,10 +199,8 @@ class TestAddonPaymentAccount(amo.tests.TestCase):
|
|||
client.api.generic.product.get_object.return_value = {
|
||||
'resource_uri': 'gpuri'}
|
||||
|
||||
client.get_product_bango.return_value = {
|
||||
'meta': {'total_count': 1},
|
||||
'objects': [{'resource_uri': 'bpruri', 'bango_id': 'bango#',
|
||||
'seller': 'selluri'}]
|
||||
client.api.bango.product.get_object.return_value = {
|
||||
'resource_uri': 'bpruri', 'bango_id': 'bango#', 'seller': 'selluri'
|
||||
}
|
||||
|
||||
apa = AddonPaymentAccount.create(
|
||||
|
@ -213,30 +211,31 @@ class TestAddonPaymentAccount(amo.tests.TestCase):
|
|||
eq_(apa.account_uri, 'acuri')
|
||||
eq_(apa.product_uri, 'bpruri')
|
||||
|
||||
client.post_make_premium.assert_called_with(
|
||||
client.api.bango.premium.post.assert_called_with(
|
||||
data={'bango': 'bango#', 'price': float(self.price.price),
|
||||
'currencyIso': 'USD', 'seller_product_bango': 'bpruri'})
|
||||
|
||||
eq_(client.post_update_rating.call_args_list[0][1]['data'],
|
||||
eq_(client.api.bango.rating.post.call_args_list[0][1]['data'],
|
||||
{'bango': 'bango#', 'rating': 'UNIVERSAL',
|
||||
'ratingScheme': 'GLOBAL', 'seller_product_bango': 'bpruri'})
|
||||
eq_(client.post_update_rating.call_args_list[1][1]['data'],
|
||||
eq_(client.api.bango.rating.post.call_args_list[1][1]['data'],
|
||||
{'bango': 'bango#', 'rating': 'GENERAL',
|
||||
'ratingScheme': 'USA', 'seller_product_bango': 'bpruri'})
|
||||
|
||||
@patch('mkt.developers.models.client')
|
||||
def test_create_new(self, client):
|
||||
client.api.generic.product.get_object.side_effect = ObjectDoesNotExist
|
||||
client.api.generic.product.post.return_value = {'resource_uri': ''}
|
||||
client.api.bango.product.get_object.side_effect = ObjectDoesNotExist
|
||||
client.api.bango.product.post.return_value = {
|
||||
'resource_uri': '', 'bango_id': 1}
|
||||
AddonPaymentAccount.create(
|
||||
'bango', addon=self.app, payment_account=self.account)
|
||||
ok_('public_id' in
|
||||
client.api.generic.product.post.call_args[1]['data'])
|
||||
ok_('packageId' in
|
||||
client.api.bango.product.post.call_args[1]['data'])
|
||||
|
||||
@patch('mkt.developers.models.client')
|
||||
def test_update_price(self, client):
|
||||
new_price = 123456
|
||||
client.get_product_bango.return_value = {'bango': 'bango#'}
|
||||
client.api.bango.product.get_object.return_value = {'bango': 'bango#'}
|
||||
|
||||
payment_account = PaymentAccount.objects.create(
|
||||
user=self.user, name='paname', uri='/path/to/object',
|
||||
|
@ -250,10 +249,10 @@ class TestAddonPaymentAccount(amo.tests.TestCase):
|
|||
apa.update_price(new_price)
|
||||
eq_(apa.set_price, new_price)
|
||||
|
||||
client.post_make_premium.assert_called_with(
|
||||
client.api.bango.premium.post.assert_called_with(
|
||||
data={'bango': 'bango#', 'price': new_price,
|
||||
'currencyIso': 'USD', 'seller_product_bango': 'bpruri'})
|
||||
client.post_update_rating.assert_called_with(
|
||||
client.api.bango.rating.post.assert_called_with(
|
||||
data={'bango': 'bango#', 'rating': 'GENERAL',
|
||||
'ratingScheme': 'USA', 'seller_product_bango': 'bpruri'})
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ from amo.tests.test_helpers import get_image_path
|
|||
from amo.urlresolvers import reverse
|
||||
from amo.utils import urlparams
|
||||
from browse.tests import test_default_sort, test_listing_sort
|
||||
from devhub.models import ActivityLog
|
||||
from files.models import FileUpload
|
||||
from files.tests.test_models import UploadTest as BaseUploadTest
|
||||
from market.models import AddonPremium, Price
|
||||
|
@ -36,7 +37,6 @@ from versions.models import Version
|
|||
import mkt
|
||||
from mkt.constants import MAX_PACKAGED_APP_SIZE
|
||||
from mkt.developers import tasks
|
||||
from mkt.developers.models import ActivityLog
|
||||
from mkt.developers.views import _filter_transactions, _get_transactions
|
||||
from mkt.site.fixtures import fixture
|
||||
from mkt.submit.models import AppSubmissionChecklist
|
||||
|
|
|
@ -23,6 +23,7 @@ from addons.forms import AddonFormBasic
|
|||
from addons.models import (Addon, AddonCategory, AddonDeviceType, AddonUser,
|
||||
Category)
|
||||
from constants.applications import DEVICE_TYPES
|
||||
from devhub.models import ActivityLog
|
||||
from lib.video.tests import files as video_files
|
||||
from users.models import UserProfile
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import amo
|
|||
import amo.tests
|
||||
from amo.tests import formset
|
||||
from addons.models import Addon, AddonUser
|
||||
from devhub.models import ActivityLog
|
||||
from mkt.developers.models import ActivityLog
|
||||
from mkt.site.fixtures import fixture
|
||||
from users.models import UserProfile
|
||||
|
|
|
@ -2,20 +2,17 @@ import mock
|
|||
from nose.tools import eq_
|
||||
from pyquery import PyQuery as pq
|
||||
|
||||
from django.db import models
|
||||
|
||||
import amo
|
||||
from amo.models import ManagerBase
|
||||
import amo.tests
|
||||
from access.models import Group, GroupUser
|
||||
from amo.urlresolvers import reverse
|
||||
from devhub.models import ActivityLog
|
||||
from reviews.models import Review, ReviewFlag
|
||||
from stats.models import ClientData, Contribution
|
||||
from stats.models import ClientData
|
||||
from users.models import UserProfile
|
||||
from zadmin.models import DownloadSource
|
||||
|
||||
import mkt
|
||||
from mkt.developers.models import ActivityLog
|
||||
from mkt.site.fixtures import fixture
|
||||
from mkt.webapps.models import Installed, Webapp
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче