class TestWebAppProduct(PurchaseTest): def setUp(self): super(TestWebAppProduct, self).setUp() self.product = WebAppProduct(self.addon) self.token = get_product_jwt( self.product, region=regions.US, user=self.user, ) self.contribution = Contribution.objects.get() def test_external_id_with_no_domain(self): with self.settings(DOMAIN=None): eq_(self.product.external_id(), 'marketplace-dev:{0}'.format(self.addon.pk)) def test_external_id_with_domain(self): with self.settings(DOMAIN='marketplace.allizom.org'): eq_(self.product.external_id(), 'marketplace:{0}'.format(self.addon.pk)) def test_webapp_product(self): eq_(self.product.id(), self.addon.pk) eq_(self.product.name(), unicode(self.addon.name)) eq_(self.product.addon(), self.addon) eq_(self.product.amount(regions.US), self.addon.get_price(region=regions.US.id)) eq_(self.product.price(), self.addon.premium.price) eq_(self.product.icons()['512'], absolutify(self.addon.get_icon_url(512))) eq_(self.product.description(), self.addon.description) eq_(self.product.application_size(), self.addon.current_version.all_files[0].size) eq_(self.product.seller_uuid(), (self.addon .single_pay_account() .payment_account .solitude_seller .uuid)) product_data = self.product.product_data(self.contribution) eq_(product_data['contrib_uuid'], self.contribution.uuid) eq_(product_data['seller_uuid'], self.product.seller_uuid()) eq_(product_data['public_id'], self.product.public_id()) eq_(product_data['addon_id'], self.product.addon().pk) eq_(product_data['application_size'], self.product.application_size())
class TestWebAppProduct(PurchaseTest): def setUp(self): super(TestWebAppProduct, self).setUp() self.product = WebAppProduct(self.addon) self.token = get_product_jwt( self.product, region=regions.US, user=self.user, ) self.contribution = Contribution.objects.get() def test_external_id_with_no_domain(self): with self.settings(DOMAIN=None): eq_(self.product.external_id(), 'marketplace-dev:{0}'.format(self.addon.pk)) def test_external_id_with_domain(self): with self.settings(DOMAIN='marketplace.allizom.org'): eq_(self.product.external_id(), 'marketplace:{0}'.format(self.addon.pk)) def test_webapp_product(self): eq_(self.product.id(), self.addon.pk) eq_(self.product.name(), unicode(self.addon.name)) eq_(self.product.addon(), self.addon) eq_(self.product.amount(regions.US), self.addon.get_price(region=regions.US.id)) eq_(self.product.price(), self.addon.premium.price) eq_(self.product.icons()['512'], absolutify(self.addon.get_icon_url(512))) eq_(self.product.description(), self.addon.description) eq_(self.product.application_size(), self.addon.current_version.all_files[0].size) eq_(self.product.seller_uuid(), (self.addon.single_pay_account(). payment_account.solitude_seller.uuid)) product_data = self.product.product_data(self.contribution) eq_(product_data['contrib_uuid'], self.contribution.uuid) eq_(product_data['seller_uuid'], self.product.seller_uuid()) eq_(product_data['public_id'], self.product.public_id()) eq_(product_data['addon_id'], self.product.addon().pk) eq_(product_data['application_size'], self.product.application_size())