This repository has been archived on 2021-04-21. You can view files and clone it, but cannot push or open issues or pull requests.
djangoldp-webpushnotification/djangoldp_webpushnotification/tests/tests_vapidkeyset.py

16 lines
509 B
Python

from base64 import urlsafe_b64encode
import ecdsa
from django.test import TestCase
from djangoldp_webpushnotification.models import VAPIDKeyset
from ecdsa import SigningKey
class TestRSAKey(TestCase):
def test_vapidkeyset_public_key(self):
priv_key = SigningKey.generate(curve=ecdsa.NIST256p)
vapid_key_set = VAPIDKeyset.objects.create(
private_key=urlsafe_b64encode(priv_key.to_string()).strip(b"=")
)
assert isinstance(vapid_key_set.public_key, bytes)