Add failing test for missing VAPID key
This commit is contained in:
parent
a0c0aa760d
commit
c64d1029b4
@ -56,3 +56,23 @@ class TestAcceptSubscription(TestCase):
|
||||
push_info = PushInformation.objects.get()
|
||||
self.assertEqual(push_info.user, self.user)
|
||||
self.assertEqual(push_info.subscription, sub_info)
|
||||
|
||||
def test_accept_sub_missing_vapid_key(self):
|
||||
payload = {
|
||||
"status_type": "subscribe",
|
||||
"subscription": {
|
||||
"endpoint": "https://hubl.example.com",
|
||||
"keys": {
|
||||
"auth": "front-end-generated-secret",
|
||||
"p256dh": "INVALID-PUBLIC-KEY",
|
||||
},
|
||||
},
|
||||
"browser": "firefox",
|
||||
}
|
||||
|
||||
url = reverse("save_webpush_info")
|
||||
response = self.client.post(
|
||||
url, data=json.dumps(payload), content_type="application/json"
|
||||
)
|
||||
|
||||
self.assertEqual(response.status_code, 403)
|
||||
|
Reference in New Issue
Block a user