Hello community, here is the log from the commit of package python-pynetbox for openSUSE:Factory checked in at 2019-11-22 10:27:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pynetbox (Old) and /work/SRC/openSUSE:Factory/.python-pynetbox.new.26869 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pynetbox" Fri Nov 22 10:27:13 2019 rev:6 rq:750092 version:4.2.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pynetbox/python-pynetbox.changes 2019-11-20 10:29:50.590593441 +0100 +++ /work/SRC/openSUSE:Factory/.python-pynetbox.new.26869/python-pynetbox.changes 2019-11-22 10:27:25.385238185 +0100 @@ -1,0 +2,8 @@ +Wed Nov 20 20:21:16 UTC 2019 - Martin Hauke <mar...@gmx.de> + +- Update to version 4.2.0 + * Fix discrepancy in DetailEndpoint.create() and the docs where + calling w/o arguments resulted in an exception. + * Add method to return custom choices. + +------------------------------------------------------------------- Old: ---- pynetbox-4.1.2.tar.gz New: ---- pynetbox-4.2.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pynetbox.spec ++++++ --- /var/tmp/diff_new_pack.09YkAD/_old 2019-11-22 10:27:26.701237798 +0100 +++ /var/tmp/diff_new_pack.09YkAD/_new 2019-11-22 10:27:26.705237796 +0100 @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-pynetbox -Version: 4.1.2 +Version: 4.2.0 Release: 0 Summary: NetBox API client library License: Apache-2.0 ++++++ pynetbox-4.1.2.tar.gz -> pynetbox-4.2.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pynetbox-4.1.2/PKG-INFO new/pynetbox-4.2.0/PKG-INFO --- old/pynetbox-4.1.2/PKG-INFO 2019-11-19 05:44:06.000000000 +0100 +++ new/pynetbox-4.2.0/PKG-INFO 2019-11-20 19:30:45.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pynetbox -Version: 4.1.2 +Version: 4.2.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-4.1.2/pynetbox/api.py new/pynetbox-4.2.0/pynetbox/api.py --- old/pynetbox-4.1.2/pynetbox/api.py 2019-11-19 05:43:48.000000000 +0100 +++ new/pynetbox-4.2.0/pynetbox/api.py 2019-11-20 19:30:27.000000000 +0100 @@ -78,6 +78,29 @@ return self._choices + def custom_choices(self): + """ Returns _custom_field_choices response from app + + :Returns: Raw response from NetBox's _custom_field_choices endpoint. + :Raises: :py:class:`.RequestError` if called for an invalid endpoint. + :Example: + + >>> nb.extras.custom_choices() + {'Testfield1': {'Testvalue2': 2, 'Testvalue1': 1}, + 'Testfield2': {'Othervalue2': 4, 'Othervalue1': 3}} + """ + custom_field_choices = Request( + base="{}/{}/_custom_field_choices/".format( + self.api.base_url, + self.name, + ), + token=self.api.token, + private_key=self.api.private_key, + ssl_verify=self.api.ssl_verify, + http_session=self.api.http_session, + ).get() + return custom_field_choices + class Api(object): """ The API object is the point of entry to pynetbox. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pynetbox-4.1.2/pynetbox/core/endpoint.py new/pynetbox-4.2.0/pynetbox/core/endpoint.py --- old/pynetbox-4.1.2/pynetbox/core/endpoint.py 2019-11-19 05:43:48.000000000 +0100 +++ new/pynetbox-4.2.0/pynetbox/core/endpoint.py 2019-11-20 19:30:27.000000000 +0100 @@ -443,7 +443,7 @@ ) return req - def create(self, data): + def create(self, data=None): """The write operation for a detail endpoint. Creates objects on a detail endpoint in NetBox. @@ -456,6 +456,8 @@ :returns: A dictionary or list of dictionaries its created in NetBox. """ + if not data: + return Request(**self.request_kwargs).post({}) return Request(**self.request_kwargs).post(data) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pynetbox-4.1.2/pynetbox.egg-info/PKG-INFO new/pynetbox-4.2.0/pynetbox.egg-info/PKG-INFO --- old/pynetbox-4.1.2/pynetbox.egg-info/PKG-INFO 2019-11-19 05:44:05.000000000 +0100 +++ new/pynetbox-4.2.0/pynetbox.egg-info/PKG-INFO 2019-11-20 19:30:45.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pynetbox -Version: 4.1.2 +Version: 4.2.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-4.1.2/pynetbox.egg-info/SOURCES.txt new/pynetbox-4.2.0/pynetbox.egg-info/SOURCES.txt --- old/pynetbox-4.1.2/pynetbox.egg-info/SOURCES.txt 2019-11-19 05:44:06.000000000 +0100 +++ new/pynetbox-4.2.0/pynetbox.egg-info/SOURCES.txt 2019-11-20 19:30:45.000000000 +0100 @@ -33,6 +33,7 @@ pynetbox/models/virtualization.py tests/__init__.py tests/test_api.py +tests/test_app.py tests/test_circuits.py tests/test_dcim.py tests/test_ipam.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pynetbox-4.1.2/tests/test_app.py new/pynetbox-4.2.0/tests/test_app.py --- old/pynetbox-4.1.2/tests/test_app.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pynetbox-4.2.0/tests/test_app.py 2019-11-20 19:30:27.000000000 +0100 @@ -0,0 +1,35 @@ +import unittest + +import six + +import pynetbox + +if six.PY3: + from unittest.mock import patch +else: + from mock import patch + +host = "http://localhost:8000" + +def_kwargs = { + 'token': 'abc123', +} + + +class AppCustomChoicesTestCase(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.extras.custom_choices() + self.assertEqual(len(choices), 2) + self.assertEqual(sorted(choices.keys()), ["Testfield1", "Testfield2"])