예제 #1
0
 def test_public_cert_invalid_jwk(self, receipt, cert_response):
     receipt.crack.return_value = self._make_receipt()
     cert_response.return_value.ok = True
     cert_response.return_value.json = lambda: {'foo': 1}
     eq_(signer()[0][:29], 'Error on checking public cert')
예제 #2
0
 def test_public_cert_not_found(self, receipt, cert_response):
     receipt.crack.return_value = self._make_receipt()
     cert_response.return_value.ok = False
     cert_response.return_value.reason = 'Not Found'
     eq_(signer()[0][:29], 'Error on checking public cert')
예제 #3
0
 def test_public_cert_no_json(self, receipt, cert_response):
     receipt.crack.return_value = self._make_receipt()
     cert_response.return_value.ok = True
     cert_response.return_value.json = lambda: None
     eq_(signer()[0][:29], 'Error on checking public cert')
예제 #4
0
 def test_public_cert_connection_error(self, receipt, cert_response):
     receipt.crack.return_value = self._make_receipt()
     cert_response.side_effect = Exception
     eq_(signer()[0][:29], 'Error on checking public cert')
예제 #5
0
 def test_good(self, receipt, cert_response):
     receipt.crack.return_value = self._make_receipt()
     cert_response.return_value.ok = True
     cert_response.return_value.json = lambda: {'jwk': []}
     eq_(signer()[0], '')
예제 #6
0
 def test_expire(self, receipt):
     now = time.time()
     receipt.crack.return_value = [{'exp': now + (3600 * 12)}, '']
     eq_(signer()[0][:21], 'Cert will expire soon')
예제 #7
0
 def test_crack_fails(self, receipt):
     receipt.crack.side_effect = ValueError
     eq_(signer()[0][:25], 'Error on cracking receipt')
예제 #8
0
 def test_sign_fails(self, receipt):
     from lib.crypto.receipt import SigningError
     receipt.sign.side_effect = SigningError
     eq_(signer()[0][:16], 'Error on signing')