Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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")
Exemplo n.º 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')
Exemplo n.º 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')
Exemplo n.º 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'}
Exemplo n.º 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'}
Exemplo n.º 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))
Exemplo n.º 9
0
 def test_expired_cert(self, mthd):
     mthd.side_effect = ExpiredSignatureError
     assert "typ" in verify.decode_receipt(".~" + sample)
Exemplo n.º 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')
Exemplo n.º 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
Exemplo n.º 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")
Exemplo n.º 13
0
 def test_expired_cert(self, mthd):
     mthd.side_effect = ExpiredSignatureError
     assert 'typ' in verify.decode_receipt('.~' + sample)
Exemplo n.º 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')
Exemplo n.º 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
Exemplo n.º 16
0
 def test_expired_cert(self, mthd):
     mthd.side_effect = ExpiredSignatureError
     assert 'typ' in verify.decode_receipt('.~' + sample)
Exemplo n.º 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())))
Exemplo n.º 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())))
Exemplo n.º 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))
Exemplo n.º 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