Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-smpplib for openSUSE:Factory 
checked in at 2021-11-08 17:24:17
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-smpplib (Old)
 and      /work/SRC/openSUSE:Factory/.python-smpplib.new.1890 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-smpplib"

Mon Nov  8 17:24:17 2021 rev:2 rq:929848 version:2.2.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-smpplib/python-smpplib.changes    
2020-09-08 22:49:28.803579233 +0200
+++ /work/SRC/openSUSE:Factory/.python-smpplib.new.1890/python-smpplib.changes  
2021-11-08 17:25:04.084728131 +0100
@@ -1,0 +2,14 @@
+Mon Oct 25 19:33:46 UTC 2021 - Martin Hauke <[email protected]>
+
+- Update to version 2.2.0
+  * New: allow customizing how error PDUs are handled
+  * New: ignoring unknown optional parameters
+  * New: add the option to create TLS/SSL sockets
+  * Fix: the max check should include the NULL terminator
+  * Fix: not always setting the socket timeout
+  * Fix: add mandatory parameters to GenericNack command
+  * Fix: handle errors on PDU payload retrieval
+- Drop patch:
+  * python-smpplib-use-unittest-mock.patch
+
+-------------------------------------------------------------------

Old:
----
  python-smpplib-use-unittest-mock.patch
  smpplib-2.1.0.tar.gz

New:
----
  smpplib-2.2.0.tar.gz

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

Other differences:
------------------
++++++ python-smpplib.spec ++++++
--- /var/tmp/diff_new_pack.DF2Zhd/_old  2021-11-08 17:25:05.136728822 +0100
+++ /var/tmp/diff_new_pack.DF2Zhd/_new  2021-11-08 17:25:05.140728826 +0100
@@ -1,8 +1,8 @@
 #
 # spec file for package python-smpplib
 #
-# Copyright (c) 2020 SUSE LLC
-# Copyright (c) 2016-2020, Martin Hauke <[email protected]>
+# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2016-2021, Martin Hauke <[email protected]>
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-smpplib
-Version:        2.1.0
+Version:        2.2.0
 Release:        0
 Summary:        SMPP library for Python
 License:        LGPL-2.0-only
@@ -27,11 +27,11 @@
 URL:            https://pypi.org/project/smpplib/
 #Git-Clone:     https://github.com/python-smpplib/python-smpplib.git
 Source:         
https://github.com/python-smpplib/python-smpplib/archive/%{version}.tar.gz#/smpplib-%{version}.tar.gz
-Patch0:         python-smpplib-use-unittest-mock.patch
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  python-rpm-macros
 # SECTION test requirements
 BuildRequires:  %{python_module pytest}
+BuildRequires:  %{python_module mock}
 # /SECTION
 BuildRequires:  fdupes
 Requires:       python-six
@@ -46,7 +46,6 @@
 
 %prep
 %setup -q -n python-smpplib-%{version}
-%patch0 -p1
 
 %build
 %python_build
@@ -54,7 +53,7 @@
 %install
 %python_install
 # Remove tests from sitelib
-%python_expand rm -R %{buildroot}%{$python_sitelib}/tests
+%python_expand rm -R %{buildroot}%{$python_sitelib}/smpplib/tests/
 %python_expand %fdupes %{buildroot}%{$python_sitelib}
 
 %check

++++++ smpplib-2.1.0.tar.gz -> smpplib-2.2.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-smpplib-2.1.0/.circleci/config.yml 
new/python-smpplib-2.2.0/.circleci/config.yml
--- old/python-smpplib-2.1.0/.circleci/config.yml       2020-03-10 
20:24:28.000000000 +0100
+++ new/python-smpplib-2.2.0/.circleci/config.yml       2021-10-19 
21:53:22.000000000 +0200
@@ -3,6 +3,8 @@
   version: 2
   test:
     jobs:
+      - test-3.9
+      - test-3.8
       - test-3.7
       - test-3.6
       - test-3.5
@@ -11,31 +13,37 @@
       - test-pypy3
       - test-pypy2
 jobs:
-  test-3.7: &test-template
+  test-3.9: &test-template
     docker:
-      - image: python:3.7
+      - image: python:3.9 # We run one test in non-alpine environment, just in 
case
     working_directory: ~/work
     steps:
       - checkout
       - run:
           name: Install dependencies
           command: |
-            python -m venv venv || pypy -m venv venv || (
+            python -m venv venv || pypy -m venv venv || {
                 pip install virtualenv && virtualenv ./venv ||
-                virtualenv -p "$(which python || which pypy)" ./venv
-            )
-            . venv/bin/activate
-            pip install pytest mock
+                virtualenv -p "$(command -v python || command -v pypy)" ./venv;
+            }
       - run:
           name: Install project
           command: |
               . venv/bin/activate
-              pip install -e .
+              pip install -e .[tests]
       - run:
           name: Run tests
           command: |
             . venv/bin/activate
             pytest -v
+  test-3.8:
+    <<: *test-template
+    docker:
+      - image: python:3.8-alpine
+  test-3.7:
+    <<: *test-template
+    docker:
+      - image: python:3.7-alpine
   test-3.6:
     <<: *test-template
     docker:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-smpplib-2.1.0/CHANGELOG.md 
new/python-smpplib-2.2.0/CHANGELOG.md
--- old/python-smpplib-2.1.0/CHANGELOG.md       2020-03-10 20:24:28.000000000 
+0100
+++ new/python-smpplib-2.2.0/CHANGELOG.md       2021-10-19 21:53:22.000000000 
+0200
@@ -1,3 +1,13 @@
+### `2.2.0`
+
+* New: allow customizing how error PDUs are handled (@davidshepherd7)
+* New: ignoring unknown optional parameters (@davidshepherd7)
+* New: add the option to create TLS/SSL sockets (@davidshepherd7)
+* Fix: the max check should include the NULL terminator (Pedrum Mohageri)
+* Fix: not always setting the socket timeout (@davidshepherd7)
+* Fix: add mandatory parameters to GenericNack command (@stefanruijsenaars)
+* Fix: handle errors on PDU payload retrieval (@stefanruijsenaars)
+
 ### `2.1.0`
 
 * New: add option to not use UDHI when splitting long SMS
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-smpplib-2.1.0/README.md 
new/python-smpplib-2.2.0/README.md
--- old/python-smpplib-2.1.0/README.md  2020-03-10 20:24:28.000000000 +0100
+++ new/python-smpplib-2.2.0/README.md  2021-10-19 21:53:22.000000000 +0200
@@ -25,7 +25,7 @@
 # Two parts, UCS2, SMS with UDH
 parts, encoding_flag, msg_type_flag = smpplib.gsm.make_parts(u'???????????? 
??????!\n'*10)
 
-client = smpplib.client.Client('example.com', SOMEPORTNUMBER)
+client = smpplib.client.Client('example.com', SOMEPORTNUMBER, 
allow_unknown_opt_params=True)
 
 # Print when obtain message_id
 client.set_message_sent_handler(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-smpplib-2.1.0/setup.py 
new/python-smpplib-2.2.0/setup.py
--- old/python-smpplib-2.1.0/setup.py   2020-03-10 20:24:28.000000000 +0100
+++ new/python-smpplib-2.2.0/setup.py   2021-10-19 21:53:22.000000000 +0200
@@ -2,18 +2,26 @@
 
 from setuptools import find_packages, setup
 
+try:
+    long_description_kwd=dict(
+        long_description=io.open('README.md', 'rt', encoding='utf-8').read(),
+        long_description_content_type='text/markdown',
+    )
+except OSError:
+    long_description_kwd=dict()
+
 setup(
     name='smpplib',
-    version='2.1.0',
+    version='2.2.0',
     url='https://github.com/podshumok/python-smpplib',
     description='SMPP library for python',
-    long_description=io.open('README.md', 'rt', encoding='utf-8').read(),
-    long_description_content_type='text/markdown',
     packages=find_packages(),
     install_requires=['six'],
-    tests_require=['pytest', 'mock', 'tox'],
+    extras_require=dict(
+        tests=('typing; python_version < "3.5"', 'pytest', 'mock'),
+    ),
     zip_safe=True,
-    classifiers=[
+    classifiers=(
         'Development Status :: 5 - Production/Stable',
         'Intended Audience :: Telecommunications Industry',
         'License :: OSI Approved :: GNU Lesser General Public License v3 
(LGPLv3)',
@@ -30,5 +38,6 @@
         'Topic :: Communications',
         'Topic :: Software Development :: Libraries :: Python Modules',
         'Topic :: Software Development :: Libraries',
-    ],
+    ),
+    **long_description_kwd
 )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-smpplib-2.1.0/smpplib/__init__.py 
new/python-smpplib-2.2.0/smpplib/__init__.py
--- old/python-smpplib-2.1.0/smpplib/__init__.py        2020-03-10 
20:24:28.000000000 +0100
+++ new/python-smpplib-2.2.0/smpplib/__init__.py        2021-10-19 
21:53:22.000000000 +0200
@@ -15,9 +15,5 @@
 # You should have received a copy of the GNU Lesser General Public
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-#
-#
-# Modified by Yusuf Kaka <yusufk at gmail>
-# Added support for Optional TLV's
 
 from smpplib import client, command, exceptions, pdu, smpp
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-smpplib-2.1.0/smpplib/client.py 
new/python-smpplib-2.2.0/smpplib/client.py
--- old/python-smpplib-2.1.0/smpplib/client.py  2020-03-10 20:24:28.000000000 
+0100
+++ new/python-smpplib-2.2.0/smpplib/client.py  2021-10-19 21:53:22.000000000 
+0200
@@ -15,10 +15,6 @@
 # You should have received a copy of the GNU Lesser General Public
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-#
-#
-# Modified by Yusuf Kaka <yusufk at gmail>
-# Added support for Optional TLV's
 
 """SMPP client module"""
 
@@ -27,6 +23,7 @@
 import select
 import socket
 import struct
+import warnings
 
 from smpplib import consts, exceptions, smpp
 
@@ -60,18 +57,43 @@
     port = None
     vendor = None
     _socket = None
+    _ssl_context = None
     sequence_generator = None
 
-    def __init__(self, host, port, timeout=5, sequence_generator=None, 
logger_name=None):
+    def __init__(
+        self,
+        host,
+        port,
+        timeout=5,
+        sequence_generator=None,
+        logger_name=None,
+        ssl_context=None,
+        allow_unknown_opt_params=None,
+    ):
         self.host = host
         self.port = int(port)
-        self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+        self._ssl_context = ssl_context
         self.timeout = timeout
         self.logger = logging.getLogger(logger_name or 
'smpp.Client.{}'.format(id(self)))
         if sequence_generator is None:
             sequence_generator = SimpleSequenceGenerator()
         self.sequence_generator = sequence_generator
 
+        if allow_unknown_opt_params is None:
+            warnings.warn(
+                "Unknown optional parameters during PDU parsing will stop "
+                "causing an exception in a future smpplib version "
+                "(in order to comply with the SMPP spec). To switch behavior "
+                "now set allow_unknown_opt_params to True.",
+                DeprecationWarning,
+            )
+            self.allow_unknown_opt_params = False
+        else:
+            self.allow_unknown_opt_params = allow_unknown_opt_params
+
+
+        self._socket = self._create_socket()
+
     def __enter__(self):
         return self
 
@@ -97,6 +119,15 @@
     def next_sequence(self):
         return self.sequence_generator.next_sequence()
 
+    def _create_socket(self):
+        raw_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+        raw_socket.settimeout(self.timeout)
+
+        if self._ssl_context is None:
+            return raw_socket
+
+        return self._ssl_context.wrap_socket(raw_socket)
+
     def connect(self):
         """Connect to SMSC"""
 
@@ -104,8 +135,7 @@
 
         try:
             if self._socket is None:
-                self._socket = socket.socket(socket.AF_INET, 
socket.SOCK_STREAM)
-                self._socket.settimeout(self.timeout)
+                self._socket = self._create_socket()
             self._socket.connect((self.host, self.port))
             self.state = consts.SMPP_CLIENT_STATE_OPEN
         except socket.error:
@@ -219,11 +249,24 @@
 
         raw_pdu = raw_len
         while len(raw_pdu) < length:
-            raw_pdu += self._socket.recv(length - len(raw_pdu))
+            try:
+                raw_pdu_part = self._socket.recv(length - len(raw_pdu))
+            except socket.timeout:
+                raise
+            except socket.error as e:
+                self.logger.warning(e)
+                raise exceptions.ConnectionError()
+            if not raw_pdu:
+                raise exceptions.ConnectionError()
+            raw_pdu += raw_pdu_part
 
         self.logger.debug('<<%s (%d bytes)', binascii.b2a_hex(raw_pdu), 
len(raw_pdu))
 
-        pdu = smpp.parse_pdu(raw_pdu, client=self)
+        pdu = smpp.parse_pdu(
+            raw_pdu,
+            client=self,
+            allow_unknown_opt_params=self.allow_unknown_opt_params,
+        )
 
         self.logger.debug('Read %s PDU', pdu.command)
 
@@ -270,6 +313,10 @@
         """Set new function to handle query resp event"""
         self.query_resp_handler = func
 
+    def set_error_pdu_handler(self, func):
+        """Set new function to handle PDUs with an error status"""
+        self.error_pdu_handler = func
+
     def message_received_handler(self, pdu, **kwargs):
         """Custom handler to process received message. May be overridden"""
         self.logger.warning('Message received handler (Override me)')
@@ -285,8 +332,24 @@
         """Custom handler to process response to queries. May be overridden"""
         self.logger.warning('Query resp handler (Override me)')
 
+    def error_pdu_handler(self, pdu):
+        raise exceptions.PDUError('({}) {}: {}'.format(
+            pdu.status,
+            pdu.command,
+            consts.DESCRIPTIONS.get(pdu.status, 'Unknown status')),
+            int(pdu.status),
+        )
+
     def read_once(self, ignore_error_codes=None, auto_send_enquire_link=True):
         """Read a PDU and act"""
+
+        if ignore_error_codes is not None:
+            warnings.warn(
+                "ignore_error_codes is deprecated, use set_error_pdu_handler 
to "
+                "configure a custom error PDU handler instead.",
+                DeprecationWarning,
+            )
+
         try:
             try:
                 pdu = self.read_pdu()
@@ -299,12 +362,7 @@
                 return
 
             if pdu.is_error():
-                raise exceptions.PDUError('({}) {}: {}'.format(
-                    pdu.status,
-                    pdu.command,
-                    consts.DESCRIPTIONS.get(pdu.status, 'Unknown status')),
-                    int(pdu.status),
-                )
+                self.error_pdu_handler(pdu)
 
             if pdu.command == 'unbind':  # unbind_res
                 self.logger.info('Unbind command received')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-smpplib-2.1.0/smpplib/command.py 
new/python-smpplib-2.2.0/smpplib/command.py
--- old/python-smpplib-2.1.0/smpplib/command.py 2020-03-10 20:24:28.000000000 
+0100
+++ new/python-smpplib-2.2.0/smpplib/command.py 2021-10-19 21:53:22.000000000 
+0200
@@ -15,9 +15,6 @@
 # You should have received a copy of the GNU Lesser General Public
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-#
-# Modified by Yusuf Kaka <yusufk at gmail>
-# Added support for Optional TLV's
 
 
 """SMPP Commands module"""
@@ -93,9 +90,11 @@
 
     params = {}
 
-    def __init__(self, command, need_sequence=True, **kwargs):
+    def __init__(self, command, need_sequence=True, 
allow_unknown_opt_params=False, **kwargs):
         super(Command, self).__init__(**kwargs)
 
+        self.allow_unknown_opt_params = allow_unknown_opt_params
+
         self.command = command
         if need_sequence and (kwargs.get('sequence') is None):
             self.sequence = self._next_seq()
@@ -171,7 +170,7 @@
             size = self.params[field].size
             value = field_value.ljust(size, chr(0))
         elif hasattr(self.params[field], 'max'):
-            if len(field_value or '') > self.params[field].max:
+            if len(field_value or '') >= self.params[field].max:
                 field_value = field_value[0:self.params[field].max - 1]
 
             if field_value:
@@ -328,9 +327,17 @@
 
         while pos < dlen:
             type_code, pos = unpack_short(data, pos)
-            field = get_optional_name(type_code)
             length, pos = unpack_short(data, pos)
 
+            try:
+                field = get_optional_name(type_code)
+            except exceptions.UnknownCommandError as e:
+                if self.allow_unknown_opt_params:
+                    logger.warning("Unknown optional parameter type 0x%x, 
skipping", type_code)
+                    pos += length
+                    continue
+                raise
+
             param = self.params[field]
             if param.type is int:
                 data, pos = self._parse_int(field, data, pos)
@@ -560,6 +567,8 @@
 class GenericNAck(Command):
     """General Negative Acknowledgement class"""
 
+    params = {}
+    params_order = ()
     _defs = []
 
     def __init__(self, command, **kwargs):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-smpplib-2.1.0/smpplib/pdu.py 
new/python-smpplib-2.2.0/smpplib/pdu.py
--- old/python-smpplib-2.1.0/smpplib/pdu.py     2020-03-10 20:24:28.000000000 
+0100
+++ new/python-smpplib-2.2.0/smpplib/pdu.py     2021-10-19 21:53:22.000000000 
+0200
@@ -15,10 +15,6 @@
 # You should have received a copy of the GNU Lesser General Public
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-#
-#
-# Modified by Yusuf Kaka <yusufk at gmail>
-# Added support for Optional TLV's
 
 """PDU module"""
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-smpplib-2.1.0/smpplib/ptypes.py 
new/python-smpplib-2.2.0/smpplib/ptypes.py
--- old/python-smpplib-2.1.0/smpplib/ptypes.py  2020-03-10 20:24:28.000000000 
+0100
+++ new/python-smpplib-2.2.0/smpplib/ptypes.py  2021-10-19 21:53:22.000000000 
+0200
@@ -15,10 +15,6 @@
 # You should have received a copy of the GNU Lesser General Public
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-#
-#
-# Modified by Yusuf Kaka <yusufk at gmail>
-# Added support for Optional TLV's
 
 """SMPP Command paramter types module"""
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-smpplib-2.1.0/smpplib/smpp.py 
new/python-smpplib-2.2.0/smpplib/smpp.py
--- old/python-smpplib-2.1.0/smpplib/smpp.py    2020-03-10 20:24:28.000000000 
+0100
+++ new/python-smpplib-2.2.0/smpplib/smpp.py    2021-10-19 21:53:22.000000000 
+0200
@@ -15,10 +15,6 @@
 # You should have received a copy of the GNU Lesser General Public
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-#
-#
-# Modified by Yusuf Kaka <yusufk at gmail>
-# Added support for Optional TLV's
 
 """SMPP module"""
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-smpplib-2.1.0/smpplib/tests/test_client.py 
new/python-smpplib-2.2.0/smpplib/tests/test_client.py
--- old/python-smpplib-2.1.0/smpplib/tests/test_client.py       1970-01-01 
01:00:00.000000000 +0100
+++ new/python-smpplib-2.2.0/smpplib/tests/test_client.py       2021-10-19 
21:53:22.000000000 +0200
@@ -0,0 +1,46 @@
+import warnings
+import pytest
+from mock import Mock, call
+
+from smpplib.client import Client
+from smpplib.smpp import make_pdu
+from smpplib import consts
+from smpplib import exceptions
+
+
+def test_client_construction_allow_unknown_opt_params_warning():
+    with warnings.catch_warnings(record=True) as w:
+        client = Client("localhost", 5679)
+
+    assert len(w) == 1
+    assert "optional parameters" in str(w[0].message)
+    assert not client.allow_unknown_opt_params
+
+
+def test_client_error_pdu_default():
+    client = Client("localhost", 5679)
+    error_pdu = make_pdu("submit_sm_resp")
+    error_pdu.status = consts.SMPP_ESME_RINVMSGLEN
+    client.read_pdu = Mock(return_value=error_pdu)
+
+    with pytest.raises(exceptions.PDUError) as exec_info:
+        client.read_once()
+
+    assert exec_info.value.args[1] == consts.SMPP_ESME_RINVMSGLEN
+
+    # Should not raise
+    client.read_once(ignore_error_codes=[consts.SMPP_ESME_RINVMSGLEN])
+
+
+def test_client_error_pdu_custom_handler():
+    client = Client("localhost", 5679)
+    error_pdu = make_pdu("submit_sm_resp")
+    error_pdu.status = consts.SMPP_ESME_RINVMSGLEN
+    client.read_pdu = Mock(return_value=error_pdu)
+
+    mock_error_pdu_handler = Mock()
+    client.set_error_pdu_handler(mock_error_pdu_handler)
+
+    client.read_once()
+
+    assert mock_error_pdu_handler.mock_calls == [call(error_pdu)]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-smpplib-2.1.0/smpplib/tests/test_command.py 
new/python-smpplib-2.2.0/smpplib/tests/test_command.py
--- old/python-smpplib-2.1.0/smpplib/tests/test_command.py      1970-01-01 
01:00:00.000000000 +0100
+++ new/python-smpplib-2.2.0/smpplib/tests/test_command.py      2021-10-19 
21:53:22.000000000 +0200
@@ -0,0 +1,46 @@
+from smpplib import consts, exceptions
+from smpplib.command import DeliverSM
+
+import pytest
+
+
+def test_parse_deliver_sm():
+    pdu = DeliverSM('deliver_sm')
+    pdu.parse(
+        b"\x00\x00\x00\xcb\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x01\x00"
+        b"\x01\x0131600000000\x00\x05\x00XXX YYYY\x00\x04\x00\x00\x00\x00\x00"
+        b"\x00\x00\x00\x00\x00\x0e\x00\x01\x01\x00\x06\x00\x01\x01\x00\x1e\x00"
+        b"\t1d305b4c\x00\x04'\x00\x01\x02\x04$\x00rid:0489708364 sub:001"
+        b" dlvrd:001 submit date:1810151907 done date:1810151907 stat:DELIVRD"
+        b" err:000 text:\x04\x1f\x04@\x048\x042\x045\x04B\x04&\x00\x01\x01"
+    )
+
+    assert pdu.source_addr_ton == consts.SMPP_TON_INTL
+    assert pdu.source_addr_npi == consts.SMPP_NPI_ISDN
+    assert pdu.source_addr == b'31600000000'
+    assert pdu.destination_addr == b'XXX YYYY'
+    assert pdu.receipted_message_id == b'1d305b4c'
+    assert pdu.source_network_type == consts.SMPP_NETWORK_TYPE_GSM
+    assert pdu.message_state == consts.SMPP_MESSAGE_STATE_DELIVERED
+    assert pdu.user_message_reference is None
+
+
+def test_unrecognised_optional_parameters():
+    pdu = DeliverSM("deliver_sm", allow_unknown_opt_params=True)
+    pdu.parse(b'\x00\x00\x00\xa8\x00\x00\x00\x05\x00\x00\x00\x00/p\xc6'
+              b'\x9a\x00\x00\x0022549909028\x00\x01\x00\x00\x04\x00\x00'
+              b'\x00\x00\x00\x00\x00\x00iid:795920026 sub:001 dlvrd:001 '
+              b'submit date:200319131913 done date:200319131913 stat:DELIVRD 
err:000 text:'
+              b'\x14\x03\x00\x07(null)\x00\x14\x02\x00\x04612\x00'
+    )
+
+    # This is only to avoid a breaking change, at some point the other 
behaviour
+    # should become the default.
+    with pytest.raises(exceptions.UnknownCommandError):
+        pdu2 = DeliverSM("deliver_sm")
+        pdu2.parse(b'\x00\x00\x00\xa8\x00\x00\x00\x05\x00\x00\x00\x00/p\xc6'
+                  b'\x9a\x00\x00\x0022549909028\x00\x01\x00\x00\x04\x00\x00'
+                  b'\x00\x00\x00\x00\x00\x00iid:795920026 sub:001 dlvrd:001 '
+                  b'submit date:200319131913 done date:200319131913 
stat:DELIVRD err:000 text:'
+                  b'\x14\x03\x00\x07(null)\x00\x14\x02\x00\x04612\x00'
+        )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-smpplib-2.1.0/smpplib/tests/test_gsm.py 
new/python-smpplib-2.2.0/smpplib/tests/test_gsm.py
--- old/python-smpplib-2.1.0/smpplib/tests/test_gsm.py  1970-01-01 
01:00:00.000000000 +0100
+++ new/python-smpplib-2.2.0/smpplib/tests/test_gsm.py  2021-10-19 
21:53:22.000000000 +0200
@@ -0,0 +1,62 @@
+# -*- coding: utf8 -*-
+
+import mock
+from pytest import mark, raises
+
+from smpplib import consts
+from smpplib.gsm import gsm_encode, make_parts, make_parts_encoded
+
+
[email protected]('plaintext, encoded_text', [
+    (u'@', b'\x00'),
+    (u'^', b'\x1B\x14'),
+])
+def test_gsm_encode(plaintext, encoded_text):
+    assert gsm_encode(plaintext) == encoded_text
+
+
[email protected]('plaintext', [
+    (u'????',),
+])
+def test_gsm_encode_unicode_error(plaintext):
+    with raises(UnicodeError):
+        gsm_encode(plaintext)
+
+
[email protected]('plaintext, encoding, expected_parts, expected_encoding', [
+    (u'@', consts.SMPP_ENCODING_DEFAULT, [b'\x00'], 
consts.SMPP_ENCODING_DEFAULT),
+    (u'????', consts.SMPP_ENCODING_DEFAULT, [b'\x04\x10\x04O'], 
consts.SMPP_ENCODING_ISO10646),
+    (u'??', consts.SMPP_ENCODING_ISO88591, [b'\xe9'], 
consts.SMPP_ENCODING_ISO88591),
+])
+def test_make_parts_single(plaintext, encoding, expected_parts, 
expected_encoding):
+    assert make_parts(plaintext, encoding) == (expected_parts, 
expected_encoding, consts.SMPP_MSGTYPE_DEFAULT)
+
+
[email protected]('plaintext, expected', [
+    (u'@' * consts.SEVENBIT_PART_SIZE * 2, [
+        b'\x05\x00\x03\x42\x02\x01' + b'\x00' * consts.SEVENBIT_PART_SIZE,
+        b'\x05\x00\x03\x42\x02\x02' + b'\x00' * consts.SEVENBIT_PART_SIZE,
+    ]),
+])
+def test_make_parts_multiple(plaintext, expected):
+    with mock.patch('random.randint') as randint:
+        randint.return_value = 0x42
+        assert make_parts(plaintext) == (expected, 
consts.SMPP_ENCODING_DEFAULT, consts.SMPP_GSMFEAT_UDHI)
+
+
[email protected]('encoded_text, part_size, expected', [
+    (b'12345', 5, [b'\x05\x00\x03\x42\x01\x0112345']),
+    (b'12345', 2, [b'\x05\x00\x03\x42\x03\x0112', 
b'\x05\x00\x03\x42\x03\x0234', b'\x05\x00\x03\x42\x03\x035']),
+])
+def test_make_parts_encoded(encoded_text, part_size, expected):
+    with mock.patch('random.randint') as randint:
+        randint.return_value = 0x42
+        assert make_parts_encoded(encoded_text, part_size) == expected
+
+
[email protected]('text, expected', [
+    (u'???????????? ??????!\n' * 10, 2),
+])
+def test_part_number(text, expected):
+    parts, _, _ = make_parts(text)
+    assert len(parts) == expected
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-smpplib-2.1.0/tests/test_command.py 
new/python-smpplib-2.2.0/tests/test_command.py
--- old/python-smpplib-2.1.0/tests/test_command.py      2020-03-10 
20:24:28.000000000 +0100
+++ new/python-smpplib-2.2.0/tests/test_command.py      1970-01-01 
01:00:00.000000000 +0100
@@ -1,23 +0,0 @@
-from smpplib import consts
-from smpplib.command import DeliverSM
-
-
-def test_parse_deliver_sm():
-    pdu = DeliverSM('deliver_sm')
-    pdu.parse(
-        b"\x00\x00\x00\xcb\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x01\x00"
-        b"\x01\x0131600000000\x00\x05\x00XXX YYYY\x00\x04\x00\x00\x00\x00\x00"
-        b"\x00\x00\x00\x00\x00\x0e\x00\x01\x01\x00\x06\x00\x01\x01\x00\x1e\x00"
-        b"\t1d305b4c\x00\x04'\x00\x01\x02\x04$\x00rid:0489708364 sub:001"
-        b" dlvrd:001 submit date:1810151907 done date:1810151907 stat:DELIVRD"
-        b" err:000 text:\x04\x1f\x04@\x048\x042\x045\x04B\x04&\x00\x01\x01"
-    )
-
-    assert pdu.source_addr_ton == consts.SMPP_TON_INTL
-    assert pdu.source_addr_npi == consts.SMPP_NPI_ISDN
-    assert pdu.source_addr == b'31600000000'
-    assert pdu.destination_addr == b'XXX YYYY'
-    assert pdu.receipted_message_id == b'1d305b4c'
-    assert pdu.source_network_type == consts.SMPP_NETWORK_TYPE_GSM
-    assert pdu.message_state == consts.SMPP_MESSAGE_STATE_DELIVERED
-    assert pdu.user_message_reference is None
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-smpplib-2.1.0/tests/test_gsm.py 
new/python-smpplib-2.2.0/tests/test_gsm.py
--- old/python-smpplib-2.1.0/tests/test_gsm.py  2020-03-10 20:24:28.000000000 
+0100
+++ new/python-smpplib-2.2.0/tests/test_gsm.py  1970-01-01 01:00:00.000000000 
+0100
@@ -1,62 +0,0 @@
-# -*- coding: utf8 -*-
-
-import mock
-from pytest import mark, raises
-
-from smpplib import consts
-from smpplib.gsm import gsm_encode, make_parts, make_parts_encoded
-
-
[email protected]('plaintext, encoded_text', [
-    (u'@', b'\x00'),
-    (u'^', b'\x1B\x14'),
-])
-def test_gsm_encode(plaintext, encoded_text):
-    assert gsm_encode(plaintext) == encoded_text
-
-
[email protected]('plaintext', [
-    (u'????',),
-])
-def test_gsm_encode_unicode_error(plaintext):
-    with raises(UnicodeError):
-        gsm_encode(plaintext)
-
-
[email protected]('plaintext, encoding, expected_parts, expected_encoding', [
-    (u'@', consts.SMPP_ENCODING_DEFAULT, [b'\x00'], 
consts.SMPP_ENCODING_DEFAULT),
-    (u'????', consts.SMPP_ENCODING_DEFAULT, [b'\x04\x10\x04O'], 
consts.SMPP_ENCODING_ISO10646),
-    (u'??', consts.SMPP_ENCODING_ISO88591, [b'\xe9'], 
consts.SMPP_ENCODING_ISO88591),
-])
-def test_make_parts_single(plaintext, encoding, expected_parts, 
expected_encoding):
-    assert make_parts(plaintext, encoding) == (expected_parts, 
expected_encoding, consts.SMPP_MSGTYPE_DEFAULT)
-
-
[email protected]('plaintext, expected', [
-    (u'@' * consts.SEVENBIT_PART_SIZE * 2, [
-        b'\x05\x00\x03\x42\x02\x01' + b'\x00' * consts.SEVENBIT_PART_SIZE,
-        b'\x05\x00\x03\x42\x02\x02' + b'\x00' * consts.SEVENBIT_PART_SIZE,
-    ]),
-])
-def test_make_parts_multiple(plaintext, expected):
-    with mock.patch('random.randint') as randint:
-        randint.return_value = 0x42
-        assert make_parts(plaintext) == (expected, 
consts.SMPP_ENCODING_DEFAULT, consts.SMPP_GSMFEAT_UDHI)
-
-
[email protected]('encoded_text, part_size, expected', [
-    (b'12345', 5, [b'\x05\x00\x03\x42\x01\x0112345']),
-    (b'12345', 2, [b'\x05\x00\x03\x42\x03\x0112', 
b'\x05\x00\x03\x42\x03\x0234', b'\x05\x00\x03\x42\x03\x035']),
-])
-def test_make_parts_encoded(encoded_text, part_size, expected):
-    with mock.patch('random.randint') as randint:
-        randint.return_value = 0x42
-        assert make_parts_encoded(encoded_text, part_size) == expected
-
-
[email protected]('text, expected', [
-    (u'???????????? ??????!\n' * 10, 2),
-])
-def test_part_number(text, expected):
-    parts, _, _ = make_parts(text)
-    assert len(parts) == expected
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-smpplib-2.1.0/tox.ini 
new/python-smpplib-2.2.0/tox.ini
--- old/python-smpplib-2.1.0/tox.ini    2020-03-10 20:24:28.000000000 +0100
+++ new/python-smpplib-2.2.0/tox.ini    1970-01-01 01:00:00.000000000 +0100
@@ -1,8 +0,0 @@
-[tox]
-envlist = py26, py27, py34, py35, py36, py37
-
-[testenv]
-commands = pytest {posargs}
-deps =
-    pytest
-    mock

Reply via email to