(self)
| 84 | |
| 85 | @pytest.mark.skipif(skip_if_no_cryptography(), reason='cryptography not installed') |
| 86 | def test_rsa_encrypt_decrypt(self): |
| 87 | from wechatpy.pay.utils import rsa_encrypt, rsa_decrypt |
| 88 | target_string = 'hello world' |
| 89 | with open(os.path.join(_CERTS_PATH, 'rsa_public_key.pem'), 'rb') as public_fp, \ |
| 90 | open(os.path.join(_CERTS_PATH, 'rsa_private_key.pem'), 'rb') as private_fp: |
| 91 | encrypted_string = rsa_encrypt(target_string, public_fp.read(), b64_encode=False) |
| 92 | self.assertEqual(rsa_decrypt(encrypted_string, private_fp.read()), target_string.encode('utf-8')) |
nothing calls this directly
no test coverage detected