Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-py-vapid for openSUSE:Factory 
checked in at 2021-09-08 21:36:45
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-py-vapid (Old)
 and      /work/SRC/openSUSE:Factory/.python-py-vapid.new.1899 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-py-vapid"

Wed Sep  8 21:36:45 2021 rev:2 rq:917409 version:1.8.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-py-vapid/python-py-vapid.changes  
2020-06-18 10:27:37.052731617 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-py-vapid.new.1899/python-py-vapid.changes    
    2021-09-08 21:37:07.073923681 +0200
@@ -1,0 +2,12 @@
+Wed Sep  8 04:27:28 UTC 2021 - Steve Kowalik <steven.kowa...@suse.com>
+
+- Update to 1.8.2:
+  * allow hyphens in sub domains (#96)
+  * Fix argument declaration (#95)
+  * use better host validation(#92)
+  * do not enforce dot in sub claim email host part (#90)
+  * switch to pytest from nose
+  * fix JWT padding (Thanks @JohnDoee) #81 
+- Drop skip-test_sign_01.patch, no longer required
+
+-------------------------------------------------------------------

Old:
----
  py-vapid-1.7.0.tar.gz
  skip-test_sign_01.patch

New:
----
  py-vapid-1.8.2.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-py-vapid.spec ++++++
--- /var/tmp/diff_new_pack.HnxSxZ/_old  2021-09-08 21:37:07.597924294 +0200
+++ /var/tmp/diff_new_pack.HnxSxZ/_new  2021-09-08 21:37:07.601924299 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python-py-vapid
 #
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2021 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,25 +18,23 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-py-vapid
-Version:        1.7.0
+Version:        1.8.2
 Release:        0
 Summary:        VAPID header generation library
 License:        MPL-2.0
-Group:          Development/Languages/Python
 URL:            https://github.com/mozilla-services/vapid
 Source:         
https://files.pythonhosted.org/packages/source/p/py-vapid/py-vapid-%{version}.tar.gz
-Patch0:         skip-test_sign_01.patch
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  fdupes
 BuildRequires:  python-rpm-macros
 Requires:       python-cryptography >= 2.5
 Requires(post): update-alternatives
-Requires(postun): update-alternatives
+Requires(postun):update-alternatives
 BuildArch:      noarch
 # SECTION test requirements
 BuildRequires:  %{python_module cryptography >= 2.5}
 BuildRequires:  %{python_module mock >= 1.0.1}
-BuildRequires:  %{python_module nose}
+BuildRequires:  %{python_module pytest}
 # /SECTION
 %python_subpackages
 
@@ -45,7 +43,6 @@
 
 %prep
 %setup -q -n py-vapid-%{version}
-%patch0 -p1
 
 %build
 %python_build
@@ -56,7 +53,7 @@
 %python_expand %fdupes %{buildroot}%{$python_sitelib}
 
 %check
-%python_exec -m nose
+%pytest
 
 %post
 %python_install_alternative vapid

++++++ py-vapid-1.7.0.tar.gz -> py-vapid-1.8.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-vapid-1.7.0/PKG-INFO new/py-vapid-1.8.2/PKG-INFO
--- old/py-vapid-1.7.0/PKG-INFO 2019-06-21 17:11:48.000000000 +0200
+++ new/py-vapid-1.8.2/PKG-INFO 2021-04-19 18:35:08.091729600 +0200
@@ -1,13 +1,12 @@
-Metadata-Version: 1.1
+Metadata-Version: 2.1
 Name: py-vapid
-Version: 1.7.0
+Version: 1.8.2
 Summary: Simple VAPID header generation library
 Home-page: https://github.com/mozilla-services/vapid
 Author: JR Conlin
 Author-email: src+va...@jrconlin.com
 License: MPL2
-Description: `PyPI version py_vapid <https://pypi.org/project/py-vapid/>`__
-        
+Description: 
         Easy VAPID generation
         =====================
         
@@ -104,14 +103,12 @@
         
         See ``bin/vapid -h`` for all options and commands.
         
-        
+        .. |PyPI version py_vapid| image:: 
https://badge.fury.io/py/py-vapid.svg
+           :target: https://pypi.org/project/py-vapid/
         
 Keywords: vapid push webpush
 Platform: UNKNOWN
 Classifier: Topic :: Internet :: WWW/HTTP
 Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.4
-Classifier: Programming Language :: Python :: 3.5
+Description-Content-Type: text/x-rst
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-vapid-1.7.0/README.md new/py-vapid-1.8.2/README.md
--- old/py-vapid-1.7.0/README.md        2019-06-13 19:14:13.000000000 +0200
+++ new/py-vapid-1.8.2/README.md        2021-04-04 17:27:28.000000000 +0200
@@ -85,8 +85,12 @@
 public/private key. If you remove or generate a new key, any
 restricted URL you've previously generated will need to be
 reallocated. Please note that some User Agents may require you [to
-decode this string into a 
Uint8Array](https://github.com/GoogleChrome/push-notifications/blob/master/app/scripts/main.js).
 
+decode this string into a 
Uint8Array](https://github.com/GoogleChrome/push-notifications/blob/master/app/scripts/main.js).
 
 See `bin/vapid -h` for all options and commands.
 
+## CHANGELOG
 
+I'm terrible about updating the Changelog. Please see the [`git
+log`](https://github.com/web-push-libs/vapid/pulls?q=is%3Apr+is%3Aclosed)
+history for details.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-vapid-1.7.0/README.rst 
new/py-vapid-1.8.2/README.rst
--- old/py-vapid-1.7.0/README.rst       2019-06-21 17:11:48.000000000 +0200
+++ new/py-vapid-1.8.2/README.rst       2020-06-17 15:53:23.000000000 +0200
@@ -1,4 +1,3 @@
-`PyPI version py_vapid <https://pypi.org/project/py-vapid/>`__
 
 Easy VAPID generation
 =====================
@@ -95,3 +94,6 @@
 Uint8Array 
<https://github.com/GoogleChrome/push-notifications/blob/master/app/scripts/main.js>`__.
 
 See ``bin/vapid -h`` for all options and commands.
+
+.. |PyPI version py_vapid| image:: https://badge.fury.io/py/py-vapid.svg
+   :target: https://pypi.org/project/py-vapid/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-vapid-1.7.0/py_vapid/__init__.py 
new/py-vapid-1.8.2/py_vapid/__init__.py
--- old/py-vapid-1.7.0/py_vapid/__init__.py     2019-06-21 17:01:28.000000000 
+0200
+++ new/py-vapid-1.8.2/py_vapid/__init__.py     2021-04-19 18:34:15.000000000 
+0200
@@ -38,13 +38,16 @@
     _public_key = None
     _schema = "WebPush"
 
-    def __init__(self, private_key=None):
+    def __init__(self, private_key=None, conf=None):
         """Initialize VAPID with an optional private key.
 
         :param private_key: A private key object
         :type private_key: ec.EllipticCurvePrivateKey
 
         """
+        if conf is None:
+            conf = {}
+        self.conf = conf
         self.private_key = private_key
         if private_key:
             self._public_key = self.private_key.public_key()
@@ -110,6 +113,7 @@
 
         """
         if not os.path.isfile(private_key_file):
+            logging.info("Private key not found, generating key...")
             vapid = cls()
             vapid.generate_keys()
             vapid.save_key(private_key_file)
@@ -258,9 +262,11 @@
         cclaims = copy.deepcopy(claims)
         if not cclaims.get('exp'):
             cclaims['exp'] = str(int(time.time()) + 86400)
-        if not re.match(r'mailto:.+@.+\..+',
-                        cclaims.get('sub', ''),
-                        re.IGNORECASE):
+        if not self.conf.get('no-strict', False):
+            valid = _check_sub(cclaims.get('sub', ''))
+        else:
+            valid = cclaims.get('sub') is not None
+        if not valid:
             raise VapidException(
                 "Missing 'sub' from claims. "
                 "'sub' is your admin email as a mailto: link.")
@@ -344,5 +350,11 @@
             verification_token=tokens[1]
         )
 
+def _check_sub(sub):
+    pattern =(
+        
r"^(mailto:.+@((localhost|[%\w-]+(\.[%\w-]+)+|([0-9a-f]{1,4}):+([0-9a-f]{1,4})?)))|https:\/\/(localhost|[\w-]+\.[\w\.-]+|([0-9a-f]{1,4}:+)+([0-9a-f]{1,4})?)$"
+        )
+    return re.match(pattern, sub, re.IGNORECASE) is not None
+
 
 Vapid = Vapid02
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-vapid-1.7.0/py_vapid/jwt.py 
new/py-vapid-1.8.2/py_vapid/jwt.py
--- old/py-vapid-1.7.0/py_vapid/jwt.py  2019-04-13 03:23:44.000000000 +0200
+++ new/py-vapid-1.8.2/py_vapid/jwt.py  2020-06-08 18:07:17.000000000 +0200
@@ -83,5 +83,5 @@
     token = "{}.{}".format(header, claims)
     rsig = key.sign(token.encode('utf8'), ec.ECDSA(hashes.SHA256()))
     (r, s) = utils.decode_dss_signature(rsig)
-    sig = b64urlencode(num_to_bytes(r) + num_to_bytes(s))
+    sig = b64urlencode(num_to_bytes(r, 32) + num_to_bytes(s, 32))
     return "{}.{}".format(token, sig)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-vapid-1.7.0/py_vapid/main.py 
new/py-vapid-1.8.2/py_vapid/main.py
--- old/py-vapid-1.7.0/py_vapid/main.py 2019-06-13 19:14:13.000000000 +0200
+++ new/py-vapid-1.8.2/py_vapid/main.py 2021-04-19 18:34:15.000000000 +0200
@@ -31,6 +31,8 @@
                         default=False, action="store_true")
     parser.add_argument('--json',  help="dump as json",
                         default=False, action="store_true")
+    parser.add_argument('--no-strict', help='Do not be strict about "sub"',
+                        default=False, action="store_true")
     parser.add_argument('--applicationServerKey',
                         help="show applicationServerKey value",
                         default=False, action="store_true")
@@ -52,7 +54,7 @@
                 if answer == 'n':
                     print("Sorry, can't do much for you then.")
                     exit(1)
-        vapid = Vapid()
+        vapid = Vapid(conf=args)
         vapid.generate_keys()
         print("Generating private_key.pem")
         vapid.save_key('private_key.pem')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-vapid-1.7.0/py_vapid/tests/test_vapid.py 
new/py-vapid-1.8.2/py_vapid/tests/test_vapid.py
--- old/py-vapid-1.7.0/py_vapid/tests/test_vapid.py     2019-06-21 
17:01:28.000000000 +0200
+++ new/py-vapid-1.8.2/py_vapid/tests/test_vapid.py     2021-04-19 
18:34:15.000000000 +0200
@@ -5,14 +5,12 @@
 import json
 import unittest
 from cryptography.hazmat.primitives import serialization
-from nose.tools import eq_, ok_
 from mock import patch, Mock
 
-from py_vapid import Vapid01, Vapid02, VapidException
+from py_vapid import Vapid01, Vapid02, VapidException, _check_sub
 from py_vapid.jwt import decode
 
-# This is a private key in DER form.
-T_DER = """
+TEST_KEY_PRIVATE_DER = """
 MHcCAQEEIPeN1iAipHbt8+/KZ2NIF8NeN24jqAmnMLFZEMocY8RboAoGCCqGSM49
 AwEHoUQDQgAEEJwJZq/GN8jJbo1GGpyU70hmP2hbWAUpQFKDByKB81yldJ9GTklB
 M5xqEwuPM7VuQcyiLDhvovthPIXx+gsQRQ==
@@ -25,17 +23,18 @@
 )
 
 # This is the same private key, in PEM form.
-T_PRIVATE = ("-----BEGIN PRIVATE KEY-----{}"
-             "-----END PRIVATE KEY-----\n").format(T_DER)
+TEST_KEY_PRIVATE_PEM = (
+    "-----BEGIN PRIVATE KEY-----{}"
+    "-----END PRIVATE KEY-----\n").format(TEST_KEY_PRIVATE_DER)
 
 # This is the same private key, as a point in uncompressed form. This should
 # be Base64url-encoded without padding.
-T_RAW = """
+TEST_KEY_PRIVATE_RAW = """
 943WICKkdu3z78pnY0gXw143biOoCacwsVkQyhxjxFs
 """.strip().encode('utf8')
 
 # This is a public key in PEM form.
-T_PUBLIC = """-----BEGIN PUBLIC KEY-----
+TEST_KEY_PUBLIC_PEM = """-----BEGIN PUBLIC KEY-----
 MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEEJwJZq/GN8jJbo1GGpyU70hmP2hb
 WAUpQFKDByKB81yldJ9GTklBM5xqEwuPM7VuQcyiLDhvovthPIXx+gsQRQ==
 -----END PUBLIC KEY-----
@@ -43,44 +42,44 @@
 
 # this is a public key in uncompressed form ('\x04' + 2 * 32 octets)
 # Remember, this should have any padding stripped.
-T_PUBLIC_RAW = (
+TEST_KEY_PUBLIC_RAW = (
     "BBCcCWavxjfIyW6NRhqclO9IZj9oW1gFKUBSgwcigfNc"
     "pXSfRk5JQTOcahMLjzO1bkHMoiw4b6L7YTyF8foLEEU"
     ).strip('=').encode('utf8')
 
 
-def setUp(self):
+def setup_module(self):
     with open('/tmp/private', 'w') as ff:
-        ff.write(T_PRIVATE)
+        ff.write(TEST_KEY_PRIVATE_PEM)
     with open('/tmp/public', 'w') as ff:
-        ff.write(T_PUBLIC)
+        ff.write(TEST_KEY_PUBLIC_PEM)
     with open('/tmp/private.der', 'w') as ff:
-        ff.write(T_DER)
+        ff.write(TEST_KEY_PRIVATE_DER)
 
 
-def tearDown(self):
+def teardown_module(self):
     os.unlink('/tmp/private')
     os.unlink('/tmp/public')
 
 
 class VapidTestCase(unittest.TestCase):
     def check_keys(self, v):
-        eq_(v.private_key.private_numbers().private_value, key.get('d'))
-        eq_(v.public_key.public_numbers().x, key.get('x'))
-        eq_(v.public_key.public_numbers().y, key.get('y'))
+        assert v.private_key.private_numbers().private_value == key.get('d')
+        assert v.public_key.public_numbers().x == key.get('x')
+        assert v.public_key.public_numbers().y == key.get('y')
 
     def test_init(self):
         v1 = Vapid01.from_file("/tmp/private")
         self.check_keys(v1)
-        v2 = Vapid01.from_pem(T_PRIVATE.encode())
+        v2 = Vapid01.from_pem(TEST_KEY_PRIVATE_PEM.encode())
         self.check_keys(v2)
-        v3 = Vapid01.from_der(T_DER.encode())
+        v3 = Vapid01.from_der(TEST_KEY_PRIVATE_DER.encode())
         self.check_keys(v3)
         v4 = Vapid01.from_file("/tmp/private.der")
         self.check_keys(v4)
         no_exist = '/tmp/not_exist'
         Vapid01.from_file(no_exist)
-        ok_(os.path.isfile(no_exist))
+        assert os.path.isfile(no_exist)
         os.unlink(no_exist)
 
     def repad(self, data):
@@ -95,8 +94,8 @@
     def test_gen_key(self):
         v = Vapid01()
         v.generate_keys()
-        ok_(v.public_key)
-        ok_(v.private_key)
+        assert v.public_key
+        assert v.private_key
 
     def test_private_key(self):
         v = Vapid01()
@@ -105,8 +104,8 @@
 
     def test_public_key(self):
         v = Vapid01()
-        eq_(v._private_key, None)
-        eq_(v._public_key, None)
+        assert v._private_key is None
+        assert v._public_key is None
 
     def test_save_key(self):
         v = Vapid01()
@@ -121,22 +120,22 @@
         os.unlink("/tmp/p2")
 
     def test_from_raw(self):
-        v = Vapid01.from_raw(T_RAW)
+        v = Vapid01.from_raw(TEST_KEY_PRIVATE_RAW)
         self.check_keys(v)
 
     def test_from_string(self):
-        v1 = Vapid01.from_string(T_DER)
-        v2 = Vapid01.from_string(T_RAW.decode())
+        v1 = Vapid01.from_string(TEST_KEY_PRIVATE_DER)
+        v2 = Vapid01.from_string(TEST_KEY_PRIVATE_RAW.decode())
         self.check_keys(v1)
         self.check_keys(v2)
 
     def test_sign_01(self):
-        v = Vapid01.from_string(T_DER)
+        v = Vapid01.from_string(TEST_KEY_PRIVATE_DER)
         claims = {"aud": "https://example.com";,
                   "sub": "mailto:ad...@example.com"}
         result = v.sign(claims, "id=previous")
-        eq_(result['Crypto-Key'],
-            'id=previous;p256ecdsa=' + T_PUBLIC_RAW.decode('utf8'))
+        assert result['Crypto-Key'] == (
+            'id=previous;p256ecdsa=' + TEST_KEY_PUBLIC_RAW.decode('utf8'))
         pkey = binascii.b2a_base64(
             v.public_key.public_bytes(
                 serialization.Encoding.X962,
@@ -145,16 +144,16 @@
         ).decode('utf8').replace('+', '-').replace('/', '_').strip()
         items = decode(result['Authorization'].split(' ')[1], pkey)
         for k in claims:
-            eq_(items[k], claims[k])
+            assert items[k] == claims[k]
         result = v.sign(claims)
-        eq_(result['Crypto-Key'],
-            'p256ecdsa=' + T_PUBLIC_RAW.decode('utf8'))
+        assert result['Crypto-Key'] == ('p256ecdsa=' +
+            TEST_KEY_PUBLIC_RAW.decode('utf8'))
         # Verify using the same function as Integration
         # this should ensure that the r,s sign values are correctly formed
-        ok_(Vapid01.verify(
+        assert Vapid01.verify(
             key=result['Crypto-Key'].split('=')[1],
             auth=result['Authorization']
-        ))
+        )
 
     def test_sign_02(self):
         v = Vapid02.from_file("/tmp/private")
@@ -164,20 +163,20 @@
         claim_check = copy.deepcopy(claims)
         result = v.sign(claims, "id=previous")
         auth = result['Authorization']
-        eq_(auth[:6], 'vapid ')
-        ok_(' t=' in auth)
-        ok_(',k=' in auth)
+        assert auth[:6] == 'vapid '
+        assert ' t=' in auth
+        assert ',k=' in auth
         parts = auth[6:].split(',')
-        eq_(len(parts), 2)
+        assert len(parts) == 2
         t_val = json.loads(base64.urlsafe_b64decode(
             self.repad(parts[0][2:].split('.')[1])
         ).decode('utf8'))
         k_val = binascii.a2b_base64(self.repad(parts[1][2:]))
-        eq_(binascii.hexlify(k_val)[:2], b'04')
-        eq_(len(k_val), 65)
-        eq_(claims, claim_check)
+        assert binascii.hexlify(k_val)[:2] == b'04'
+        assert len(k_val) == 65
+        assert claims == claim_check
         for k in claims:
-            eq_(t_val[k], claims[k])
+            assert t_val[k] == claims[k]
 
     def test_sign_02_localhost(self):
         v = Vapid02.from_file("/tmp/private")
@@ -186,9 +185,9 @@
                   "foo": "extra value"}
         result = v.sign(claims, "id=previous")
         auth = result['Authorization']
-        eq_(auth[:6], 'vapid ')
-        ok_(' t=' in auth)
-        ok_(',k=' in auth)
+        assert auth[:6] == 'vapid '
+        assert ' t=' in auth
+        assert ',k=' in auth
 
     def test_integration(self):
         # These values were taken from a test page. DO NOT ALTER!
@@ -199,8 +198,8 @@
                 "4cCI6MTQ5NDY3MTQ3MCwic3ViIjoibWFpbHRvOnNpbXBsZS1wdXNoLWRlb"
                 "W9AZ2F1bnRmYWNlLmNvLnVrIn0.LqPi86T-HJ71TXHAYFptZEHD7Wlfjcc"
                 "4u5jYZ17WpqOlqDcW-5Wtx3x1OgYX19alhJ9oLumlS2VzEvNioZolQA")
-        ok_(Vapid01.verify(key=key, auth="webpush {}".format(auth)))
-        ok_(Vapid02.verify(auth="vapid t={},k={}".format(auth, key)))
+        assert Vapid01.verify(key=key, auth="webpush {}".format(auth))
+        assert Vapid02.verify(auth="vapid t={},k={}".format(auth, key))
 
     def test_bad_integration(self):
         # These values were taken from a test page. DO NOT ALTER!
@@ -211,7 +210,7 @@
                 "4cCI6MTQ5NDY3MTQ3MCwic3ViIjoibWFpbHRvOnNpbXBsZS1wdXNoLWRlb"
                 "W9AZ2F1bnRmYWNlLmNvLnVrIn0.LqPi86T-HJ71TXHAYFptZEHD7Wlfjcc"
                 "4u5jYZ17WpqOlqDcW-5Wtx3x1OgYX19alhJ9oLumlS2VzEvNioZ_BAD")
-        eq_(Vapid01.verify(key=key, auth=auth), False)
+        assert Vapid01.verify(key=key, auth=auth) == False
 
     def test_bad_sign(self):
         v = Vapid01.from_file("/tmp/private")
@@ -229,7 +228,12 @@
         self.assertRaises(VapidException,
                           v.sign,
                           {'sub': 'mailto:f...@bar.com',
-                              'aud': "https://p.example.com:8080/"})
+                           'aud': "https://p.example.com:8080/"})
+
+    def test_ignore_sub(self):
+        v = Vapid02.from_file("/tmp/private")
+        v.conf['no-strict'] = True
+        assert v.sign({"sub": "foo", "aud": "http://localhost:8000"})
 
     @patch('cryptography.hazmat.primitives.asymmetric'
            '.ec.EllipticCurvePublicNumbers')
@@ -248,3 +252,31 @@
                           decode,
                           'foo.bar.a',
                           'aaaa')
+
+    def test_sub(self):
+        valid = [
+            'mailto:me@localhost',
+            'mailto:me@1.2.3.4',
+            'mailto:me@1234::',
+            'mailto:me@1234::5678',
+            'mailto:ad...@example.org',
+            'mailto:admin-test-c...@example-test-case.test.org',
+            'https://localhost',
+            'https://exmample-test-case.test.org',
+            'https://8001::',
+            'https://8001:1000:0001',
+            'https://1.2.3.4'
+        ]
+        invalid = [
+            'mailto:@foobar.com',
+            'mailto:example.org',
+            'mailto:0123:',
+            'mailto:::1234',
+            'https://somehost',
+            'https://xyz:123',
+        ]
+
+        for val in valid:
+            assert _check_sub(val) is True
+        for val in invalid:
+            assert _check_sub(val) is False
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-vapid-1.7.0/py_vapid/utils.py 
new/py-vapid-1.8.2/py_vapid/utils.py
--- old/py-vapid-1.7.0/py_vapid/utils.py        2019-04-13 03:23:44.000000000 
+0200
+++ new/py-vapid-1.8.2/py_vapid/utils.py        2020-06-08 18:07:17.000000000 
+0200
@@ -26,11 +26,14 @@
     return base64.urlsafe_b64encode(data).replace(b'=', b'').decode('utf8')
 
 
-def num_to_bytes(n):
+def num_to_bytes(n, pad_to):
     """Returns the byte representation of an integer, in big-endian order.
     :param n: The integer to encode.
     :type n: int
+    :param pad_to: Expected length of result, zeropad if necessary.
+    :type pad_to: int
     :returns bytes
     """
     h = '%x' % n
-    return binascii.unhexlify('0' * (len(h) % 2) + h)
+    r = binascii.unhexlify('0' * (len(h) % 2) + h)
+    return b'\x00' * (pad_to - len(r)) + r
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-vapid-1.7.0/py_vapid.egg-info/PKG-INFO 
new/py-vapid-1.8.2/py_vapid.egg-info/PKG-INFO
--- old/py-vapid-1.7.0/py_vapid.egg-info/PKG-INFO       2019-06-21 
17:11:48.000000000 +0200
+++ new/py-vapid-1.8.2/py_vapid.egg-info/PKG-INFO       2021-04-19 
18:35:07.000000000 +0200
@@ -1,13 +1,12 @@
-Metadata-Version: 1.1
+Metadata-Version: 2.1
 Name: py-vapid
-Version: 1.7.0
+Version: 1.8.2
 Summary: Simple VAPID header generation library
 Home-page: https://github.com/mozilla-services/vapid
 Author: JR Conlin
 Author-email: src+va...@jrconlin.com
 License: MPL2
-Description: `PyPI version py_vapid <https://pypi.org/project/py-vapid/>`__
-        
+Description: 
         Easy VAPID generation
         =====================
         
@@ -104,14 +103,12 @@
         
         See ``bin/vapid -h`` for all options and commands.
         
-        
+        .. |PyPI version py_vapid| image:: 
https://badge.fury.io/py/py-vapid.svg
+           :target: https://pypi.org/project/py-vapid/
         
 Keywords: vapid push webpush
 Platform: UNKNOWN
 Classifier: Topic :: Internet :: WWW/HTTP
 Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.4
-Classifier: Programming Language :: Python :: 3.5
+Description-Content-Type: text/x-rst
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-vapid-1.7.0/py_vapid.egg-info/SOURCES.txt 
new/py-vapid-1.8.2/py_vapid.egg-info/SOURCES.txt
--- old/py-vapid-1.7.0/py_vapid.egg-info/SOURCES.txt    2019-06-21 
17:11:48.000000000 +0200
+++ new/py-vapid-1.8.2/py_vapid.egg-info/SOURCES.txt    2021-04-19 
18:35:07.000000000 +0200
@@ -1,4 +1,3 @@
-CHANGELOG.md
 LICENSE
 MANIFEST.in
 README.md
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-vapid-1.7.0/setup.py new/py-vapid-1.8.2/setup.py
--- old/py-vapid-1.7.0/setup.py 2019-06-21 17:02:23.000000000 +0200
+++ new/py-vapid-1.8.2/setup.py 2021-04-19 18:32:46.000000000 +0200
@@ -3,7 +3,7 @@
 
 from setuptools import setup, find_packages
 
-__version__ = "1.7.0"
+__version__ = "1.8.2"
 
 
 def read_from(file):
@@ -24,31 +24,27 @@
 here = os.path.abspath(os.path.dirname(__file__))
 with io.open(os.path.join(here, 'README.rst'), encoding='utf8') as f:
     README = f.read()
-with io.open(os.path.join(here, 'CHANGELOG.md'), encoding='utf8') as f:
-    CHANGES = f.read()
+#with io.open(os.path.join(here, 'CHANGELOG.md'), encoding='utf8') as f:
+#    CHANGES = f.read()
 
 setup(name="py-vapid",
       version=__version__,
       description='Simple VAPID header generation library',
-      long_description=README + '\n\n' + CHANGES,
+      long_description=README,
+      long_description_content_type="text/x-rst",
       classifiers=["Topic :: Internet :: WWW/HTTP",
                    "Programming Language :: Python",
-                   "Programming Language :: Python :: 2",
-                   "Programming Language :: Python :: 2.7",
                    "Programming Language :: Python :: 3",
-                   "Programming Language :: Python :: 3.4",
-                   "Programming Language :: Python :: 3.5",
                    ],
       keywords='vapid push webpush',
       author="JR Conlin",
       author_email="src+va...@jrconlin.com",
       url='https://github.com/mozilla-services/vapid',
       license="MPL2",
-      test_suite="nose.collector",
       include_package_data=True,
       zip_safe=False,
       packages=find_packages(),
-      package_data={'': ['README.md', 'CHANGELOG.md',
+      package_data={'': ['README.rst',
                          'requirements.txt', 'test-requirements.txt']},
       install_requires=read_from('requirements.txt'),
       tests_require=read_from('test-requirements.txt'),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/py-vapid-1.7.0/test-requirements.txt 
new/py-vapid-1.8.2/test-requirements.txt
--- old/py-vapid-1.7.0/test-requirements.txt    2018-05-21 18:42:50.000000000 
+0200
+++ new/py-vapid-1.8.2/test-requirements.txt    2021-03-12 18:42:33.000000000 
+0100
@@ -1,4 +1,5 @@
-nose
+-r requirements.txt
+pytest
 coverage
 mock>=1.0.1
 flake8

Reply via email to