Hello community,

here is the log from the commit of package python-pynetbox for openSUSE:Factory 
checked in at 2020-10-02 17:34:00
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pynetbox (Old)
 and      /work/SRC/openSUSE:Factory/.python-pynetbox.new.4249 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-pynetbox"

Fri Oct  2 17:34:00 2020 rev:16 rq:837380 version:5.1.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pynetbox/python-pynetbox.changes  
2020-08-24 15:15:06.738745181 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-pynetbox.new.4249/python-pynetbox.changes    
    2020-10-02 17:34:03.974622798 +0200
@@ -1,0 +2,13 @@
+Thu Sep 24 18:40:51 UTC 2020 - Martin Hauke <mar...@gmx.de>
+
+- Update to version 5.1.0
+  * Add Basic plugins support (#290).
+
+-------------------------------------------------------------------
+Wed Sep  2 05:58:23 UTC 2020 - Martin Hauke <mar...@gmx.de>
+
+- Update to version 5.0.8
+  * Fixes malformed URL when calling .save() and .delete() on
+    nested objects.
+
+-------------------------------------------------------------------

Old:
----
  pynetbox-5.0.7.tar.gz

New:
----
  pynetbox-5.1.0.tar.gz

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

Other differences:
------------------
++++++ python-pynetbox.spec ++++++
--- /var/tmp/diff_new_pack.8ipJBn/_old  2020-10-02 17:34:04.698623229 +0200
+++ /var/tmp/diff_new_pack.8ipJBn/_new  2020-10-02 17:34:04.698623229 +0200
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-pynetbox
-Version:        5.0.7
+Version:        5.1.0
 Release:        0
 Summary:        NetBox API client library
 License:        Apache-2.0

++++++ pynetbox-5.0.7.tar.gz -> pynetbox-5.1.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-5.0.7/.github/workflows/py3pr.yml 
new/pynetbox-5.1.0/.github/workflows/py3pr.yml
--- old/pynetbox-5.0.7/.github/workflows/py3pr.yml      2020-08-20 
20:18:00.000000000 +0200
+++ new/pynetbox-5.1.0/.github/workflows/py3pr.yml      2020-09-24 
16:25:58.000000000 +0200
@@ -19,10 +19,10 @@
           python-version: ${{ matrix.python }}
 
       - name: Install pynetbox and testing packages.
-        run: pip install . black pytest
+        run: pip install . black==19.10b0 pytest
 
       - name: Run Linter
-        run: black --check .
+        run: black --diff pynetbox tests
           
       - name: Run Tests
         run: pytest
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-5.0.7/PKG-INFO new/pynetbox-5.1.0/PKG-INFO
--- old/pynetbox-5.0.7/PKG-INFO 2020-08-20 20:18:06.812076800 +0200
+++ new/pynetbox-5.1.0/PKG-INFO 2020-09-24 16:26:06.181355700 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pynetbox
-Version: 5.0.7
+Version: 5.1.0
 Summary: NetBox API client library
 Home-page: https://github.com/digitalocean/pynetbox
 Author: Zach Moody
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-5.0.7/pynetbox/core/api.py 
new/pynetbox-5.1.0/pynetbox/core/api.py
--- old/pynetbox-5.0.7/pynetbox/core/api.py     2020-08-20 20:18:00.000000000 
+0200
+++ new/pynetbox-5.1.0/pynetbox/core/api.py     2020-09-24 16:25:58.000000000 
+0200
@@ -18,7 +18,7 @@
 import requests
 
 from pynetbox.core.query import Request
-from pynetbox.core.app import App
+from pynetbox.core.app import App, PluginsApp
 
 
 class Api(object):
@@ -100,6 +100,7 @@
         self.tenancy = App(self, "tenancy")
         self.extras = App(self, "extras")
         self.virtualization = App(self, "virtualization")
+        self.plugins = PluginsApp(self)
 
     @property
     def version(self):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-5.0.7/pynetbox/core/app.py 
new/pynetbox-5.1.0/pynetbox/core/app.py
--- old/pynetbox-5.0.7/pynetbox/core/app.py     2020-08-20 20:18:00.000000000 
+0200
+++ new/pynetbox-5.1.0/pynetbox/core/app.py     2020-09-24 16:25:58.000000000 
+0200
@@ -109,3 +109,42 @@
             http_session=self.api.http_session,
         ).get()
         return custom_field_choices
+
+
+class PluginsApp(object):
+    """
+    Basically valid plugins api could be handled by same App class,
+    but you need to add plugins to request url path.
+
+    :returns: :py:class:`.App` with added plugins into path.
+
+    """
+
+    def __init__(self, api):
+        self.api = api
+
+    def __getattr__(self, name):
+        return App(self.api, 'plugins/{}'.format(name))
+
+    def installed_plugins(self):
+        """ Returns raw response with installed plugins
+
+        :returns: Raw response NetBox's installed plugins.
+        :Example:
+
+        >>> nb.plugins.installed_plugins()
+        [{
+            'name': 'test_plugin', 
+            'package': 'test_plugin', 
+            'author': 'Dmitry', 
+            'description': 'Netbox test plugin', 
+            'verison': '0.10'
+        }]
+        """
+        installed_plugins = Request(
+            base="{}/plugins/installed-plugins".format(self.api.base_url,),
+            token=self.api.token,
+            private_key=self.api.private_key,
+            http_session=self.api.http_session,
+        ).get()
+        return installed_plugins
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-5.0.7/pynetbox/core/response.py 
new/pynetbox-5.1.0/pynetbox/core/response.py
--- old/pynetbox-5.0.7/pynetbox/core/response.py        2020-08-20 
20:18:00.000000000 +0200
+++ new/pynetbox-5.1.0/pynetbox/core/response.py        2020-09-24 
16:25:58.000000000 +0200
@@ -382,7 +382,7 @@
             if diff:
                 serialized = self.serialize()
                 req = Request(
-                    key=self.id if not self.url else None,
+                    key=self.id,
                     base=self.endpoint.url,
                     token=self.api.token,
                     session_key=self.api.session_key,
@@ -430,7 +430,7 @@
         >>>
         """
         req = Request(
-            key=self.id if not self.url else None,
+            key=self.id,
             base=self.endpoint.url,
             token=self.api.token,
             session_key=self.api.session_key,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-5.0.7/pynetbox.egg-info/PKG-INFO 
new/pynetbox-5.1.0/pynetbox.egg-info/PKG-INFO
--- old/pynetbox-5.0.7/pynetbox.egg-info/PKG-INFO       2020-08-20 
20:18:06.000000000 +0200
+++ new/pynetbox-5.1.0/pynetbox.egg-info/PKG-INFO       2020-09-24 
16:26:05.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pynetbox
-Version: 5.0.7
+Version: 5.1.0
 Summary: NetBox API client library
 Home-page: https://github.com/digitalocean/pynetbox
 Author: Zach Moody
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-5.0.7/tests/test_app.py 
new/pynetbox-5.1.0/tests/test_app.py
--- old/pynetbox-5.0.7/tests/test_app.py        2020-08-20 20:18:00.000000000 
+0200
+++ new/pynetbox-5.1.0/tests/test_app.py        2020-09-24 16:25:58.000000000 
+0200
@@ -29,3 +29,31 @@
         choices = api.extras.custom_choices()
         self.assertEqual(len(choices), 2)
         self.assertEqual(sorted(choices.keys()), ["Testfield1", "Testfield2"])
+
+
+class PluginAppCustomChoicesTestCase(unittest.TestCase):
+    @patch(
+        "pynetbox.core.query.Request.get",
+        return_value={
+            "Testfield1": {"TF1_1": 1, "TF1_2": 2},
+            "Testfield2": {"TF2_1": 3, "TF2_2": 4},
+        },
+    )
+    def test_custom_choices(self, *_):
+        api = pynetbox.api(host, **def_kwargs)
+        choices = api.plugins.test_plugin.custom_choices()
+        self.assertEqual(len(choices), 2)
+        self.assertEqual(sorted(choices.keys()), ["Testfield1", "Testfield2"])
+
+    @patch(
+        "pynetbox.core.query.Request.get",
+        return_value=[{
+            "name": "test_plugin",
+            "package": "netbox_test_plugin",
+        }],
+    )
+    def test_installed_plugins(self, *_):
+        api = pynetbox.api(host, **def_kwargs)
+        plugins = api.plugins.installed_plugins()
+        self.assertEqual(len(plugins), 1)
+        self.assertEqual(plugins[0]["name"], "test_plugin")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-5.0.7/tests/unit/test_response.py 
new/pynetbox-5.1.0/tests/unit/test_response.py
--- old/pynetbox-5.0.7/tests/unit/test_response.py      2020-08-20 
20:18:00.000000000 +0200
+++ new/pynetbox-5.1.0/tests/unit/test_response.py      2020-09-24 
16:25:58.000000000 +0200
@@ -214,7 +214,7 @@
                 "child": {
                     "id": 321,
                     "name": "test123",
-                    "url": "http://localhost:8080/api/test-app/test-endpoint/";,
+                    "url": 
"http://localhost:8080/api/test-app/test-endpoint/321/";,
                 },
             },
             app,
@@ -224,7 +224,7 @@
         test.child.save()
         self.assertEqual(
             app.http_session.patch.call_args[0][0],
-            "http://localhost:8080/api/test-app/test-endpoint/";,
+            "http://localhost:8080/api/test-app/test-endpoint/321/";,
         )
 
     def test_endpoint_from_url(self):


Reply via email to