add in app:// origins to the receipt (bug 867265)

This commit is contained in:
Andy McKay 2013-07-16 13:29:37 -07:00
Родитель 4ba53ff8eb
Коммит da0d062fd6
2 изменённых файлов: 11 добавлений и 4 удалений

Просмотреть файл

@ -141,7 +141,14 @@ class TestReceipt(amo.tests.TestCase):
user = UserProfile.objects.get(pk=5497308)
ins = self.create_install(user, webapp)
receipt = self.for_user(ins, 'developer')
eq_(receipt['product']['url'], 'http://testserver')
eq_(receipt['product']['url'], 'app://foo.com')
def test_receipt_packaged_no_origin(self):
webapp = addon_factory(type=amo.ADDON_WEBAPP, is_packaged=True)
user = UserProfile.objects.get(pk=5497308)
ins = self.create_install(user, webapp)
receipt = self.for_user(ins, 'developer')
eq_(receipt['product']['url'], settings.SITE_URL)
@mock.patch.object(settings, 'SIGNING_SERVER_ACTIVE', True)
@mock.patch('mkt.receipts.utils.sign')

Просмотреть файл

@ -22,9 +22,9 @@ def create_receipt(installed, flavour=None):
typ = 'purchase-receipt'
product = {'storedata': urlencode({'id': int(webapp.pk)}),
# Trunion needs to see https:// URLs.
'url': settings.SITE_URL
if webapp.is_packaged else webapp.origin}
# Packaged and hosted apps should have an origin. If there
# isn't one, fallback to the SITE_URL.
'url': webapp.origin or settings.SITE_URL}
# Generate different receipts for reviewers or developers.
expiry = time_ + settings.WEBAPPS_RECEIPT_EXPIRY_SECONDS