Example #1
0
 def test_crack_receipt_new_called(self, trunion_verify, settings):
     # Check that we can decode our receipt and get a dictionary back.
     self.app.update(manifest_url='http://a.com')
     verify.decode_receipt(
         'jwt_public_key~' +
         create_receipt(self.app, self.user, str(uuid.uuid4())))
     assert trunion_verify.called
Example #2
0
 def test_crack_receipt_new_called(self, trunion_verify, settings):
     # Check that we can decode our receipt and get a dictionary back.
     self.app.update(type=amo.ADDON_WEBAPP, manifest_url='http://a.com')
     verify.decode_receipt(
         'jwt_public_key~' + create_receipt(
             self.app, self.user, str(uuid.uuid4())))
     assert trunion_verify.called
Example #3
0
 def test_crack_receipt(self):
     # Check that we can decode our receipt and get a dictionary back.
     self.app.update(manifest_url="http://a.com")
     purchase = self.make_purchase()
     receipt = create_receipt(purchase.webapp, purchase.user, purchase.uuid)
     result = verify.decode_receipt(receipt)
     eq_(result["typ"], u"purchase-receipt")
Example #4
0
 def test_crack_receipt(self):
     # Check that we can decode our receipt and get a dictionary back.
     self.addon.update(type=amo.ADDON_WEBAPP, manifest_url='http://a.com')
     purchase = self.make_purchase()
     receipt = create_receipt(purchase.addon, purchase.user, purchase.uuid)
     result = verify.decode_receipt(receipt)
     eq_(result['typ'], u'purchase-receipt')
Example #5
0
 def test_crack_receipt(self):
     # Check that we can decode our receipt and get a dictionary back.
     self.addon.update(type=amo.ADDON_WEBAPP, manifest_url='http://a.com')
     purchase = self.make_purchase()
     receipt = create_receipt(purchase.addon, purchase.user, purchase.uuid)
     result = verify.decode_receipt(receipt)
     eq_(result['typ'], u'purchase-receipt')
Example #6
0
def test_verify(request, status):
    try:
        result = decode_receipt(request.body)
        # TODO: insert type and url checks here.
        if result:
            return {'status': status}
    except:
        log.error('Decoding test receipt', exc_info=True)
        return {'status': 'invalid'}
Example #7
0
def test_verify(request, status):
    try:
        result = decode_receipt(request.body)
        # TODO: insert type and url checks here.
        if result:
            return {'status': status}
    except:
        log.error('Decoding test receipt', exc_info=True)
        return {'status': 'invalid'}
Example #8
0
 def test_issue_expired(self):
     data = {'receipt_type': 'expired', 'manifest_url': 'http://foo.com/'}
     res = self.client.post(self.issue, data=data)
     data = decode_receipt(json.loads(res.content)['receipt']
                               .encode('ascii'))
     eq_(data['verify'], absolutify(reverse('receipt.test.verify',
                                    kwargs={'status': 'expired'})))
     ok_(data['exp'] > (calendar.timegm(time.gmtime()) +
                        (60 * 60 * 24) - TEST_LEEWAY))
Example #9
0
 def test_expired_cert(self, mthd):
     mthd.side_effect = ExpiredSignatureError
     assert "typ" in verify.decode_receipt(".~" + sample)
Example #10
0
 def test_crack_receipt(self):
     # Check that we can decode our receipt and get a dictionary back.
     self.addon.update(type=amo.ADDON_WEBAPP, manifest_url='http://a.com')
     receipt = self.make_install().receipt
     result = verify.decode_receipt(receipt)
     eq_(result['typ'], u'purchase-receipt')
Example #11
0
 def test_crack_receipt_new_called(self, trunion_verify, settings):
     # Check that we can decode our receipt and get a dictionary back.
     self.addon.update(type=amo.ADDON_WEBAPP, manifest_url='http://a.com')
     verify.decode_receipt('.~' + sample)
     assert trunion_verify.called
Example #12
0
 def test_crack_receipt(self):
     # Check that we can decode our receipt and get a dictionary back.
     self.addon.update(type=amo.ADDON_WEBAPP, manifest_url="http://a.com")
     receipt = create_receipt(self.make_install().pk)
     result = verify.decode_receipt(receipt)
     eq_(result["typ"], u"purchase-receipt")
Example #13
0
 def test_expired_cert(self, mthd):
     mthd.side_effect = ExpiredSignatureError
     assert 'typ' in verify.decode_receipt('.~' + sample)
Example #14
0
 def test_crack_receipt(self):
     # Check that we can decode our receipt and get a dictionary back.
     self.addon.update(type=amo.ADDON_WEBAPP, manifest_url='http://a.com')
     receipt = self.make_install().receipt
     result = verify.decode_receipt(receipt)
     eq_(result['typ'], u'purchase-receipt')
Example #15
0
 def test_crack_receipt_new_called(self, trunion_verify, settings):
     # Check that we can decode our receipt and get a dictionary back.
     self.addon.update(type=amo.ADDON_WEBAPP, manifest_url='http://a.com')
     verify.decode_receipt('.~' + sample)
     assert trunion_verify.called
Example #16
0
 def test_expired_cert(self, mthd):
     mthd.side_effect = ExpiredSignatureError
     assert 'typ' in verify.decode_receipt('.~' + sample)
Example #17
0
 def test_expired_cert(self, mthd):
     mthd.side_effect = ExpiredSignatureError
     assert 'typ' in verify.decode_receipt(
         'jwt_public_key~' +
         create_receipt(self.app, self.user, str(uuid.uuid4())))
Example #18
0
 def test_expired_cert(self, mthd):
     mthd.side_effect = ExpiredSignatureError
     assert 'typ' in verify.decode_receipt(
         'jwt_public_key~' + create_receipt(
             self.app, self.user, str(uuid.uuid4())))
Example #19
0
 def test_issue_expired(self):
     data = {"receipt_type": "expired", "manifest_url": "http://foo.com/"}
     res = self.client.post(self.issue, data=data)
     data = decode_receipt(json.loads(res.content)["receipt"].encode("ascii"))
     eq_(data["verify"], absolutify(reverse("receipt.test.verify", kwargs={"status": "expired"})))
     ok_(data["exp"] > (calendar.timegm(time.gmtime()) + (60 * 60 * 24) - TEST_LEEWAY))
Example #20
0
 def test_crack_receipt_new_called(self, trunion_verify, settings):
     # Check that we can decode our receipt and get a dictionary back.
     self.app.update(manifest_url="http://a.com")
     verify.decode_receipt("jwt_public_key~" + create_receipt(self.app, self.user, str(uuid.uuid4())))
     assert trunion_verify.called