Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-openwrt-luci-rpc for 
openSUSE:Factory checked in at 2022-10-06 07:42:04
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-openwrt-luci-rpc (Old)
 and      /work/SRC/openSUSE:Factory/.python-openwrt-luci-rpc.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-openwrt-luci-rpc"

Thu Oct  6 07:42:04 2022 rev:2 rq:1008149 version:1.1.12

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-openwrt-luci-rpc/python-openwrt-luci-rpc.changes
  2020-05-29 21:36:00.534405517 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-openwrt-luci-rpc.new.2275/python-openwrt-luci-rpc.changes
        2022-10-06 07:42:15.192693865 +0200
@@ -1,0 +2,32 @@
+Wed Oct  5 09:34:00 UTC 2022 - Daniel Garcia <[email protected]>
+
+- Update to 1.1.12 (2022-09-11)
+  * Includes latest fixes to support newer versions of OpenWrt
+
+-------------------------------------------------------------------
+Tue Oct  4 22:11:04 UTC 2022 - Yogalakshmi Arunachalam <[email protected]>
+
+- Update to 1.1.11 (2021-03-21)
+  * Add rst-linter pre-commit hook to prevent committing errors to HISTORY.rst 
#50  
+
+- Update to 1.1.10 (2021-03-21)
+  * Also trigger the Github Actions on push of tags (#49)
+
+- Update to 1.1.9 (2021-03-21)
+  * Publish to pypi only once in github actions (#47)
+
+- Update to 1.1.8 (2021-03-12)
+  * Support newer openwrt snapshot versions (#45)
+  * Fix tox in github actions and also test py38 (#46)
+
+- Update to 1.1.7 (2020-12-08)
+  * Switch pipeline to Github actions
+
+- Update to 1.1.6 (2020-09-01)
+  * Fixes home-assistant/core/issues/38870, home-assistant/core/issues/39498
+  * Fixes fbradyirl/openwrt-luci-rpc/issues/33
+
+- Update to 1.1.5 (2020-09-01)
+  * Unpin pip versions. Allow higher. Fixes #42 
https://github.com/fbradyirl/openwrt-luci-rpc/issues/42
+
+-------------------------------------------------------------------

Old:
----
  openwrt-luci-rpc-1.1.3.tar.gz

New:
----
  openwrt-luci-rpc-1.1.12.tar.gz

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

Other differences:
------------------
++++++ python-openwrt-luci-rpc.spec ++++++
--- /var/tmp/diff_new_pack.Aq1x57/_old  2022-10-06 07:42:15.748695103 +0200
+++ /var/tmp/diff_new_pack.Aq1x57/_new  2022-10-06 07:42:15.756695121 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python-openwrt-luci-rpc
 #
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-openwrt-luci-rpc
-Version:        1.1.3
+Version:        1.1.12
 Release:        0
 Summary:        Module for interacting with OpenWrt Luci RPC interface
 License:        Apache-2.0

++++++ openwrt-luci-rpc-1.1.3.tar.gz -> openwrt-luci-rpc-1.1.12.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/openwrt-luci-rpc-1.1.3/HISTORY.rst 
new/openwrt-luci-rpc-1.1.12/HISTORY.rst
--- old/openwrt-luci-rpc-1.1.3/HISTORY.rst      2020-04-20 17:12:21.000000000 
+0200
+++ new/openwrt-luci-rpc-1.1.12/HISTORY.rst     2022-09-11 14:48:53.000000000 
+0200
@@ -79,7 +79,7 @@
 
 * As a convenience, as the router IP as the host
   for every device. Can be useful when a network has more
-  than one router. 
+  than one router.
 
 1.0.6 (2019-02-26)
 ------------------
@@ -110,3 +110,45 @@
 * Suppress "InsecureRequestWarning: Unverified HTTPS request is being made. 
Adding certificate verification is strongly advised." warnings.
 * Reduce number of info log messages.
 * Minor code clean-up to address flake8 warnings.
+
+
+1.1.3 (2020-04-20)
+------------------
+* Add packaging
+
+
+1.1.5 (2020-09-01)
+------------------
+* Unpin pip versions. Allow higher. Fixes #42 
https://github.com/fbradyirl/openwrt-luci-rpc/issues/42
+
+
+1.1.6 (2020-09-01)
+------------------
+* Fixes home-assistant/core/issues/38870, home-assistant/core/issues/39498
+* Fixes fbradyirl/openwrt-luci-rpc/issues/33
+
+1.1.7 (2020-12-08)
+------------------
+* Switch pipeline to Github actions
+
+1.1.8 (2021-03-12)
+------------------
+* Support newer openwrt snapshot versions (#45)
+* Fix tox in github actions and also test py38 (#46)
+
+1.1.9 (2021-03-21)
+------------------
+* Publish to pypi only once in github actions (#47)
+
+1.1.10 (2021-03-21)
+-------------------
+* Also trigger the Github Actions on push of tags (#49)
+
+1.1.11 (2021-03-21)
+-------------------
+* Add rst-linter pre-commit hook to prevent committing errors to HISTORY.rst 
#50
+
+
+1.1.12 (2022-09-11)
+-------------------
+* Includes latest fixes to support newer versions of OpenWrt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/openwrt-luci-rpc-1.1.3/PKG-INFO 
new/openwrt-luci-rpc-1.1.12/PKG-INFO
--- old/openwrt-luci-rpc-1.1.3/PKG-INFO 2020-04-20 17:12:45.000000000 +0200
+++ new/openwrt-luci-rpc-1.1.12/PKG-INFO        2022-09-11 14:48:56.601897000 
+0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: openwrt-luci-rpc
-Version: 1.1.3
+Version: 1.1.12
 Summary: Module for interacting with OpenWrt Luci RPC interface
 Home-page: https://github.com/fbradyirl/openwrt-luci-rpc
 Author: Finbarr Brady
@@ -15,8 +15,8 @@
         .. image:: https://img.shields.io/pypi/v/openwrt_luci_rpc.svg
                 :target: https://pypi.python.org/pypi/openwrt_luci_rpc
         
-        .. image:: https://img.shields.io/travis/fbradyirl/openwrt-luci-rpc.svg
-                :target: https://travis-ci.org/fbradyirl/openwrt-luci-rpc/
+        .. image:: 
https://github.com/fbradyirl/openwrt-luci-rpc/workflows/Python%20package/badge.svg
+                :target: https://github.com/fbradyirl/openwrt-luci-rpc/actions
         
         .. image:: 
https://readthedocs.org/projects/openwrt-luci-rpc/badge/?version=latest
                 :target: 
https://openwrt-luci-rpc.readthedocs.io/en/latest/?badge=latest
@@ -128,7 +128,7 @@
         
         * As a convenience, as the router IP as the host
           for every device. Can be useful when a network has more
-          than one router. 
+          than one router.
         
         1.0.6 (2019-02-26)
         ------------------
@@ -160,6 +160,48 @@
         * Reduce number of info log messages.
         * Minor code clean-up to address flake8 warnings.
         
+        
+        1.1.3 (2020-04-20)
+        ------------------
+        * Add packaging
+        
+        
+        1.1.5 (2020-09-01)
+        ------------------
+        * Unpin pip versions. Allow higher. Fixes #42 
https://github.com/fbradyirl/openwrt-luci-rpc/issues/42
+        
+        
+        1.1.6 (2020-09-01)
+        ------------------
+        * Fixes home-assistant/core/issues/38870, 
home-assistant/core/issues/39498
+        * Fixes fbradyirl/openwrt-luci-rpc/issues/33
+        
+        1.1.7 (2020-12-08)
+        ------------------
+        * Switch pipeline to Github actions
+        
+        1.1.8 (2021-03-12)
+        ------------------
+        * Support newer openwrt snapshot versions (#45)
+        * Fix tox in github actions and also test py38 (#46)
+        
+        1.1.9 (2021-03-21)
+        ------------------
+        * Publish to pypi only once in github actions (#47)
+        
+        1.1.10 (2021-03-21)
+        -------------------
+        * Also trigger the Github Actions on push of tags (#49)
+        
+        1.1.11 (2021-03-21)
+        -------------------
+        * Add rst-linter pre-commit hook to prevent committing errors to 
HISTORY.rst #50
+        
+        
+        1.1.12 (2022-09-11)
+        -------------------
+        * Includes latest fixes to support newer versions of OpenWrt
+        
 Keywords: openwrt-luci-rpc
 Platform: UNKNOWN
 Classifier: Development Status :: 2 - Pre-Alpha
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/openwrt-luci-rpc-1.1.3/README.rst 
new/openwrt-luci-rpc-1.1.12/README.rst
--- old/openwrt-luci-rpc-1.1.3/README.rst       2020-04-20 17:12:21.000000000 
+0200
+++ new/openwrt-luci-rpc-1.1.12/README.rst      2022-09-11 14:48:53.000000000 
+0200
@@ -7,8 +7,8 @@
 .. image:: https://img.shields.io/pypi/v/openwrt_luci_rpc.svg
         :target: https://pypi.python.org/pypi/openwrt_luci_rpc
 
-.. image:: https://img.shields.io/travis/fbradyirl/openwrt-luci-rpc.svg
-        :target: https://travis-ci.org/fbradyirl/openwrt-luci-rpc/
+.. image:: 
https://github.com/fbradyirl/openwrt-luci-rpc/workflows/Python%20package/badge.svg
+        :target: https://github.com/fbradyirl/openwrt-luci-rpc/actions
 
 .. image:: 
https://readthedocs.org/projects/openwrt-luci-rpc/badge/?version=latest
         :target: 
https://openwrt-luci-rpc.readthedocs.io/en/latest/?badge=latest
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/openwrt-luci-rpc-1.1.3/openwrt_luci_rpc/__init__.py 
new/openwrt-luci-rpc-1.1.12/openwrt_luci_rpc/__init__.py
--- old/openwrt-luci-rpc-1.1.3/openwrt_luci_rpc/__init__.py     2020-04-20 
17:12:21.000000000 +0200
+++ new/openwrt-luci-rpc-1.1.12/openwrt_luci_rpc/__init__.py    2022-09-11 
14:48:53.000000000 +0200
@@ -4,7 +4,7 @@
 
 __author__ = """Finbarr Brady"""
 __email__ = '[email protected]'
-__version__ = '1.1.3'
+__version__ = '1.1.12'
 
 from .openwrt_luci_rpc import OpenWrtLuciRPC
 from .constants import Constants
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/openwrt-luci-rpc-1.1.3/openwrt_luci_rpc/openwrt_luci_rpc.py 
new/openwrt-luci-rpc-1.1.12/openwrt_luci_rpc/openwrt_luci_rpc.py
--- old/openwrt-luci-rpc-1.1.3/openwrt_luci_rpc/openwrt_luci_rpc.py     
2020-04-20 17:12:21.000000000 +0200
+++ new/openwrt-luci-rpc-1.1.12/openwrt_luci_rpc/openwrt_luci_rpc.py    
2022-09-11 14:48:53.000000000 +0200
@@ -124,7 +124,7 @@
             LUCI_RPC_IP_PATH.format(
                 self.host_api_url), 'neighbors', {"family": 4}
 
-        if self.owrt_version != version.parse("snapshot") and 
self.owrt_version < version.parse("18.06"):
+        if utilities.is_legacy_version(self.owrt_version):
             return True, rpc_sys_arp_call
         else:
             return False, rpc_ip_call
@@ -167,6 +167,9 @@
                                                   wlan_interfaces)
 
         for device_entry in arp_result:
+            if device_entry is None:
+                continue
+
             device_entry = utilities.normalise_keys(device_entry)
 
             if "mac" not in device_entry:
@@ -184,12 +187,17 @@
             device = namedtuple("Device", device_entry.keys())(
                 *device_entry.values())
 
-            if "Flags" in device_entry and only_reachable:
+            if self.is_legacy_version:
+                if "Flags" in device_entry and only_reachable:
                 # Check if the Flags for each device contain
                 # NUD_REACHABLE and if not, skip.
-                if not int(device_entry['Flags'], 16) & 0x2:
-                    continue
-
+                    if not int(device_entry['Flags'], 16) & 0x2:
+                        continue
+            else:
+                if "reachable" in device_entry and only_reachable:             
   
+                    if device_entry['reachable'] == False:
+                        continue
+            
             last_results.append(device)
 
         log.debug(last_results)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/openwrt-luci-rpc-1.1.3/openwrt_luci_rpc/utilities.py 
new/openwrt-luci-rpc-1.1.12/openwrt_luci_rpc/utilities.py
--- old/openwrt-luci-rpc-1.1.3/openwrt_luci_rpc/utilities.py    2020-04-20 
17:12:21.000000000 +0200
+++ new/openwrt-luci-rpc-1.1.12/openwrt_luci_rpc/utilities.py   2022-09-11 
14:48:53.000000000 +0200
@@ -1,4 +1,5 @@
 from .constants import Constants
+from packaging import version
 import logging
 
 log = logging.getLogger(__name__)
@@ -6,24 +7,24 @@
 
 def normalise_keys(result):
     """Replace 17.06 keys with newer ones."""
+    if result is not None:
 
-    # named tuple keys cannot have spaces or begin with dots. Replace
-    # those with underscores
-    result = \
-        {k.replace(".", "_").replace(" ", "_"): v for k, v in result.items()}
-
-    for old_key, new_key in Constants.MODERN_KEYS.items():
-        if old_key in result:
-            result[new_key] = result[old_key]
-            del result[old_key]
+        # named tuple keys cannot have spaces or begin with dots. Replace
+        # those with underscores
+        result = \
+            {k.replace(".", "_").replace(" ", "_"): v for k, v in 
result.items()}  # noqa: E501
+
+        for old_key, new_key in Constants.MODERN_KEYS.items():
+            if old_key in result:
+                result[new_key] = result[old_key]
+                del result[old_key]
 
     return result
 
 
 def get_hostname_from_dhcp(dhcp_result, mac):
     """Determine the hostname for this mac."""
-    if dhcp_result:
-
+    if dhcp_result is not None and isinstance(dhcp_result, dict):
         host = [x for x in dhcp_result.values()
                 if x['.type'] == 'host'
                 and 'mac' in x
@@ -36,3 +37,10 @@
             return host[0]['name']
 
     return None
+
+
+def is_legacy_version(owrt_version):
+    return (
+        "snapshot" not in owrt_version.public and
+        owrt_version < version.parse("18.06")
+    )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/openwrt-luci-rpc-1.1.3/openwrt_luci_rpc.egg-info/PKG-INFO 
new/openwrt-luci-rpc-1.1.12/openwrt_luci_rpc.egg-info/PKG-INFO
--- old/openwrt-luci-rpc-1.1.3/openwrt_luci_rpc.egg-info/PKG-INFO       
2020-04-20 17:12:44.000000000 +0200
+++ new/openwrt-luci-rpc-1.1.12/openwrt_luci_rpc.egg-info/PKG-INFO      
2022-09-11 14:48:56.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: openwrt-luci-rpc
-Version: 1.1.3
+Version: 1.1.12
 Summary: Module for interacting with OpenWrt Luci RPC interface
 Home-page: https://github.com/fbradyirl/openwrt-luci-rpc
 Author: Finbarr Brady
@@ -15,8 +15,8 @@
         .. image:: https://img.shields.io/pypi/v/openwrt_luci_rpc.svg
                 :target: https://pypi.python.org/pypi/openwrt_luci_rpc
         
-        .. image:: https://img.shields.io/travis/fbradyirl/openwrt-luci-rpc.svg
-                :target: https://travis-ci.org/fbradyirl/openwrt-luci-rpc/
+        .. image:: 
https://github.com/fbradyirl/openwrt-luci-rpc/workflows/Python%20package/badge.svg
+                :target: https://github.com/fbradyirl/openwrt-luci-rpc/actions
         
         .. image:: 
https://readthedocs.org/projects/openwrt-luci-rpc/badge/?version=latest
                 :target: 
https://openwrt-luci-rpc.readthedocs.io/en/latest/?badge=latest
@@ -128,7 +128,7 @@
         
         * As a convenience, as the router IP as the host
           for every device. Can be useful when a network has more
-          than one router. 
+          than one router.
         
         1.0.6 (2019-02-26)
         ------------------
@@ -160,6 +160,48 @@
         * Reduce number of info log messages.
         * Minor code clean-up to address flake8 warnings.
         
+        
+        1.1.3 (2020-04-20)
+        ------------------
+        * Add packaging
+        
+        
+        1.1.5 (2020-09-01)
+        ------------------
+        * Unpin pip versions. Allow higher. Fixes #42 
https://github.com/fbradyirl/openwrt-luci-rpc/issues/42
+        
+        
+        1.1.6 (2020-09-01)
+        ------------------
+        * Fixes home-assistant/core/issues/38870, 
home-assistant/core/issues/39498
+        * Fixes fbradyirl/openwrt-luci-rpc/issues/33
+        
+        1.1.7 (2020-12-08)
+        ------------------
+        * Switch pipeline to Github actions
+        
+        1.1.8 (2021-03-12)
+        ------------------
+        * Support newer openwrt snapshot versions (#45)
+        * Fix tox in github actions and also test py38 (#46)
+        
+        1.1.9 (2021-03-21)
+        ------------------
+        * Publish to pypi only once in github actions (#47)
+        
+        1.1.10 (2021-03-21)
+        -------------------
+        * Also trigger the Github Actions on push of tags (#49)
+        
+        1.1.11 (2021-03-21)
+        -------------------
+        * Add rst-linter pre-commit hook to prevent committing errors to 
HISTORY.rst #50
+        
+        
+        1.1.12 (2022-09-11)
+        -------------------
+        * Includes latest fixes to support newer versions of OpenWrt
+        
 Keywords: openwrt-luci-rpc
 Platform: UNKNOWN
 Classifier: Development Status :: 2 - Pre-Alpha
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/openwrt-luci-rpc-1.1.3/openwrt_luci_rpc.egg-info/SOURCES.txt 
new/openwrt-luci-rpc-1.1.12/openwrt_luci_rpc.egg-info/SOURCES.txt
--- old/openwrt-luci-rpc-1.1.3/openwrt_luci_rpc.egg-info/SOURCES.txt    
2020-04-20 17:12:44.000000000 +0200
+++ new/openwrt-luci-rpc-1.1.12/openwrt_luci_rpc.egg-info/SOURCES.txt   
2022-09-11 14:48:56.000000000 +0200
@@ -31,4 +31,5 @@
 tests/test_openwrt_15.py
 tests/test_openwrt_17.py
 tests/test_openwrt_18.py
-tests/test_openwrt_luci_rpc.py
\ No newline at end of file
+tests/test_openwrt_luci_rpc.py
+tests/test_version.py
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/openwrt-luci-rpc-1.1.3/openwrt_luci_rpc.egg-info/requires.txt 
new/openwrt-luci-rpc-1.1.12/openwrt_luci_rpc.egg-info/requires.txt
--- old/openwrt-luci-rpc-1.1.3/openwrt_luci_rpc.egg-info/requires.txt   
2020-04-20 17:12:44.000000000 +0200
+++ new/openwrt-luci-rpc-1.1.12/openwrt_luci_rpc.egg-info/requires.txt  
2022-09-11 14:48:56.000000000 +0200
@@ -1,3 +1,3 @@
 Click>=6.0
-requests==2.21.0
-packaging==19.1
+requests>=2.21.0
+packaging>=19.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/openwrt-luci-rpc-1.1.3/setup.cfg 
new/openwrt-luci-rpc-1.1.12/setup.cfg
--- old/openwrt-luci-rpc-1.1.3/setup.cfg        2020-04-20 17:12:45.000000000 
+0200
+++ new/openwrt-luci-rpc-1.1.12/setup.cfg       2022-09-11 14:48:56.601897000 
+0200
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 1.1.3
+current_version = 1.1.12
 commit = True
 tag = True
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/openwrt-luci-rpc-1.1.3/setup.py 
new/openwrt-luci-rpc-1.1.12/setup.py
--- old/openwrt-luci-rpc-1.1.3/setup.py 2020-04-20 17:12:21.000000000 +0200
+++ new/openwrt-luci-rpc-1.1.12/setup.py        2022-09-11 14:48:53.000000000 
+0200
@@ -11,7 +11,7 @@
 with open('HISTORY.rst') as history_file:
     history = history_file.read()
 
-requirements = ['Click>=6.0', 'requests==2.21.0', 'packaging==19.1']
+requirements = ['Click>=6.0', 'requests>=2.21.0', 'packaging>=19.1']
 
 setup_requirements = [ ]
 
@@ -39,6 +39,6 @@
     test_suite='tests',
     tests_require=test_requirements,
     url='https://github.com/fbradyirl/openwrt-luci-rpc',
-    version='1.1.3',
+    version='1.1.12',
     zip_safe=False,
 )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/openwrt-luci-rpc-1.1.3/tests/test_openwrt_luci_rpc.py 
new/openwrt-luci-rpc-1.1.12/tests/test_openwrt_luci_rpc.py
--- old/openwrt-luci-rpc-1.1.3/tests/test_openwrt_luci_rpc.py   2020-04-20 
17:12:21.000000000 +0200
+++ new/openwrt-luci-rpc-1.1.12/tests/test_openwrt_luci_rpc.py  2022-09-11 
14:48:53.000000000 +0200
@@ -73,3 +73,10 @@
         assert data['_name'] == "cfg07ee1"
         assert data['_type'] == "host"
         assert data['ip'] == "192.168.1.124"
+
+    def test_normalise_key_none_type(self):
+        """Test a None result is handled."""
+
+        data = utilities.normalise_keys(None)
+
+        assert data is None
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/openwrt-luci-rpc-1.1.3/tests/test_version.py 
new/openwrt-luci-rpc-1.1.12/tests/test_version.py
--- old/openwrt-luci-rpc-1.1.3/tests/test_version.py    1970-01-01 
01:00:00.000000000 +0100
+++ new/openwrt-luci-rpc-1.1.12/tests/test_version.py   2022-09-11 
14:48:53.000000000 +0200
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""Tests for `openwrt_luci_rpc` package."""
+
+
+import unittest
+from openwrt_luci_rpc.utilities import is_legacy_version
+from packaging import version
+
+
+class TestOpenwrtLuciRPC(unittest.TestCase):
+    """Tests for `openwrt_luci_rpc` package."""
+
+    def setUp(self):
+        """Set up test fixtures, if any."""
+
+    def tearDown(self):
+        """Tear down test fixtures, if any."""
+
+    def test_is_legacy_version(self):
+        """Test comparing versions works as expected."""
+
+        assert is_legacy_version(version.parse("15.05")) is True
+        assert is_legacy_version(version.parse("15.05.1")) is True
+        assert is_legacy_version(version.parse("17.01")) is True
+        assert is_legacy_version(version.parse("17.01.6")) is True
+
+        assert is_legacy_version(version.parse("18.06")) is False
+        assert is_legacy_version(version.parse("18.06.9")) is False
+        assert is_legacy_version(version.parse("19.07.7")) is False
+
+        assert is_legacy_version(version.parse("snapshot")) is False
+        assert is_legacy_version(version.parse("21.02-snapshot")) is False

Reply via email to