Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ build-backend = "setuptools.build_meta"

[project]
name = "pywebpush"
version = "2.1.0"
license = {text = "MPL-2.0"}
version = "2.1.2"
license = { text = "MPL-2.0" }
authors = [{ name = "JR Conlin", email = "[email protected]" }]
description = "WebPush publication library"
readme = "README.md"
Expand All @@ -20,7 +20,6 @@ classifiers = [
"Programming Language :: Python :: Implementation :: PyPy",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)",
]
dynamic = ["dependencies"]

Expand All @@ -35,7 +34,7 @@ dev = ["black", "mock", "pytest"]
pywebpush = "pywebpush.__main__:main"

[tool.setuptools.dynamic]
dependencies = {file = "requirements.txt"}
dependencies = { file = "requirements.txt" }

[tool.setuptools.packages.find]
include = ["pywebpush*"]
22 changes: 10 additions & 12 deletions pywebpush/tests/test_webpush.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,22 @@
import unittest
import time
from typing import cast, Union, Dict
from unittest.mock import patch, Mock, AsyncMock

import http_ece
import py_vapid
import requests
from mock import patch, Mock, AsyncMock
from cryptography.hazmat.primitives.asymmetric import ec
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.backends import default_backend

from pywebpush import (
WebPusher, NoData, WebPushException, CaseInsensitiveDict, webpush,
webpush_async
WebPusher,
NoData,
WebPushException,
CaseInsensitiveDict,
webpush,
webpush_async,
)


Expand All @@ -28,13 +32,9 @@ class WebpushTestUtils(unittest.TestCase):
"M5xqEwuPM7VuQcyiLDhvovthPIXx+gsQRQ=="
)

def _gen_subscription_info(
self, recv_key=None, endpoint="https://example.com/"
):
def _gen_subscription_info(self, recv_key=None, endpoint="https://example.com/"):
if not recv_key:
recv_key = ec.generate_private_key(
ec.SECP256R1(), default_backend()
)
recv_key = ec.generate_private_key(ec.SECP256R1(), default_backend())
return {
"endpoint": endpoint,
"keys": {
Expand Down Expand Up @@ -539,9 +539,7 @@ async def test_webpush_async_bad_vapid_no_key(self):
async def test_webpush_async_bad_vapid_bad_return(self, mock_post):
mock_post.return_value.status = 410
mock_post.return_value.reason = "Gone"
mock_post.return_value.text = AsyncMock(
return_value="Subscription expired"
)
mock_post.return_value.text = AsyncMock(return_value="Subscription expired")

subscription_info = self._gen_subscription_info()
data = "Mary had a little lamb"
Expand Down