Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-pynetbox for openSUSE:Factory
checked in at 2023-08-31 13:45:48
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pynetbox (Old)
and /work/SRC/openSUSE:Factory/.python-pynetbox.new.1766 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pynetbox"
Thu Aug 31 13:45:48 2023 rev:34 rq:1108076 version:7.1.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pynetbox/python-pynetbox.changes
2023-01-24 20:32:54.936560332 +0100
+++
/work/SRC/openSUSE:Factory/.python-pynetbox.new.1766/python-pynetbox.changes
2023-08-31 13:51:33.256739456 +0200
@@ -1,0 +2,11 @@
+Wed Aug 30 09:18:50 UTC 2023 - Matej Cepl <[email protected]>
+
+- Clean up the SPEC file
+
+-------------------------------------------------------------------
+Tue Aug 29 15:03:55 UTC 2023 - Martin Hauke <[email protected]>
+
+- Update to version 7.1.0
+ * Add support for NetBox v3.5.
+
+-------------------------------------------------------------------
Old:
----
pynetbox-7.0.1.tar.gz
New:
----
pynetbox-7.1.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-pynetbox.spec ++++++
--- /var/tmp/diff_new_pack.plyhDd/_old 2023-08-31 13:51:34.244774770 +0200
+++ /var/tmp/diff_new_pack.plyhDd/_new 2023-08-31 13:51:34.248774913 +0200
@@ -18,7 +18,7 @@
%define skip_python2 1
Name: python-pynetbox
-Version: 7.0.1
+Version: 7.1.0
Release: 0
Summary: NetBox API client library
License: Apache-2.0
@@ -27,13 +27,14 @@
Source:
https://files.pythonhosted.org/packages/source/p/pynetbox/pynetbox-%{version}.tar.gz
BuildRequires: %{python_module PyYAML}
BuildRequires: %{python_module netaddr}
+BuildRequires: %{python_module pip}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module requests}
BuildRequires: %{python_module setuptools_scm}
-BuildRequires: %{python_module setuptools}
+BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
-Requires: python-netaddr
+Requires: python-packaging
Requires: python-requests >= 2.20.0
BuildArch: noarch
%python_subpackages
@@ -42,13 +43,13 @@
Python API client library for NetBox.
%prep
-%setup -q -n pynetbox-%{version}
+%autosetup -p1 -n pynetbox-%{version}
%build
-%python_build
+%pyproject_wheel
%install
-%python_install
+%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
# remove testsuite from sitelib
%python_expand rm -rf %{buildroot}%{$python_sitelib}/tests
@@ -59,6 +60,7 @@
%files %{python_files}
%doc README.md CHANGELOG.md
%license LICENSE
-%{python_sitelib}/pynetbox*
+%{python_sitelib}/pynetbox
+%{python_sitelib}/pynetbox-%{version}*-info
%changelog
++++++ pynetbox-7.0.1.tar.gz -> pynetbox-7.1.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-7.0.1/.github/workflows/py3.yml
new/pynetbox-7.1.0/.github/workflows/py3.yml
--- old/pynetbox-7.0.1/.github/workflows/py3.yml 2023-01-23
21:38:54.000000000 +0100
+++ new/pynetbox-7.1.0/.github/workflows/py3.yml 2023-08-25
23:32:09.000000000 +0200
@@ -13,7 +13,7 @@
strategy:
matrix:
python: ["3.8", "3.9", "3.10"]
- netbox: ["3.3"]
+ netbox: ["3.3", "3.4", "3.5"]
steps:
- uses: actions/checkout@v2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-7.0.1/PKG-INFO new/pynetbox-7.1.0/PKG-INFO
--- old/pynetbox-7.0.1/PKG-INFO 2023-01-23 21:39:05.135211500 +0100
+++ new/pynetbox-7.1.0/PKG-INFO 2023-08-25 23:32:21.930426100 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: pynetbox
-Version: 7.0.1
+Version: 7.1.0
Summary: NetBox API client library
Home-page: https://github.com/netbox-community/pynetbox
Author: Zach Moody
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-7.0.1/README.md new/pynetbox-7.1.0/README.md
--- old/pynetbox-7.0.1/README.md 2023-01-23 21:38:54.000000000 +0100
+++ new/pynetbox-7.1.0/README.md 2023-08-25 23:32:09.000000000 +0200
@@ -57,3 +57,11 @@
threading=True,
)
```
+
+## Alternative Library
+
+> **Note:** For those interested in a different approach, there is an
alternative Python API client library available for NetBox called
[netbox-python](https://github.com/netbox-community/netbox-python). This
library provides a thin Python wrapper over the NetBox API.
+
+[netbox-python](https://github.com/netbox-community/netbox-python) offers a
minimalistic interface to interact with NetBox's API. While it may not provide
all the features available in pynetbox, it offers a lightweight and
straightforward option for interfacing with NetBox.
+
+To explore further details and access the documentation, please visit the
[netbox-python](https://github.com/netbox-community/netbox-python).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-7.0.1/pynetbox/__init__.py
new/pynetbox-7.1.0/pynetbox/__init__.py
--- old/pynetbox-7.0.1/pynetbox/__init__.py 2023-01-23 21:38:54.000000000
+0100
+++ new/pynetbox-7.1.0/pynetbox/__init__.py 2023-08-25 23:32:09.000000000
+0200
@@ -1,9 +1,6 @@
-from pkg_resources import get_distribution, DistributionNotFound
+from importlib.metadata import metadata
from pynetbox.core.query import RequestError, AllocationError, ContentError
from pynetbox.core.api import Api as api
-try:
- __version__ = get_distribution(__name__).version
-except DistributionNotFound:
- pass
+__version__ = metadata(__name__).get("Version")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-7.0.1/pynetbox/core/api.py
new/pynetbox-7.1.0/pynetbox/core/api.py
--- old/pynetbox-7.0.1/pynetbox/core/api.py 2023-01-23 21:38:54.000000000
+0100
+++ new/pynetbox-7.1.0/pynetbox/core/api.py 2023-08-25 23:32:09.000000000
+0200
@@ -27,6 +27,7 @@
you can specify which app and endpoint you wish to interact with.
Valid attributes currently are:
+ * core (NetBox 3.5+)
* dcim
* ipam
* circuits
@@ -74,6 +75,7 @@
self.base_url = base_url
self.http_session = requests.Session()
self.threading = threading
+ self.core = App(self, "core")
self.dcim = App(self, "dcim")
self.ipam = App(self, "ipam")
self.circuits = App(self, "circuits")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-7.0.1/pynetbox/core/endpoint.py
new/pynetbox-7.1.0/pynetbox/core/endpoint.py
--- old/pynetbox-7.0.1/pynetbox/core/endpoint.py 2023-01-23
21:38:54.000000000 +0100
+++ new/pynetbox-7.1.0/pynetbox/core/endpoint.py 2023-08-25
23:32:09.000000000 +0200
@@ -458,7 +458,9 @@
series = []
if not isinstance(objects, list):
raise ValueError(
- "Objects passed must be list[dict|Record] - was " +
type(objects)
+ "Objects passed must be list[dict|Record] - was {}".format(
+ type(objects)
+ )
)
for o in objects:
if isinstance(o, Record):
@@ -472,7 +474,7 @@
series.append(o)
else:
raise ValueError(
- "Object passed must be dict|Record - was " + type(objects)
+ "Object passed must be dict|Record - was
{}".format(type(objects))
)
req = Request(
base=self.url,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-7.0.1/pynetbox/core/query.py
new/pynetbox-7.1.0/pynetbox/core/query.py
--- old/pynetbox-7.0.1/pynetbox/core/query.py 2023-01-23 21:38:54.000000000
+0100
+++ new/pynetbox-7.1.0/pynetbox/core/query.py 2023-08-25 23:32:09.000000000
+0200
@@ -15,6 +15,7 @@
"""
import concurrent.futures as cf
import json
+from packaging import version
def calc_pages(limit, count):
@@ -153,12 +154,22 @@
def get_openapi(self):
"""Gets the OpenAPI Spec"""
headers = {
- "Content-Type": "application/json;",
+ "Accept": "application/json",
+ "Content-Type": "application/json",
}
- req = self.http_session.get(
- "{}docs/?format=openapi".format(self.normalize_url(self.base)),
- headers=headers,
- )
+
+ current_version = version.parse(self.get_version())
+ if current_version >= version.parse("3.5"):
+ req = self.http_session.get(
+ "{}schema/".format(self.normalize_url(self.base)),
+ headers=headers,
+ )
+ else:
+ req = self.http_session.get(
+ "{}docs/?format=openapi".format(self.normalize_url(self.base)),
+ headers=headers,
+ )
+
if req.ok:
return req.json()
else:
@@ -175,7 +186,7 @@
present in the headers.
"""
headers = {
- "Content-Type": "application/json;",
+ "Content-Type": "application/json",
}
req = self.http_session.get(
self.normalize_url(self.base),
@@ -192,7 +203,7 @@
:Returns: Dictionary as returned by NetBox.
:Raises: RequestError if request is not successful.
"""
- headers = {"Content-Type": "application/json;"}
+ headers = {"Content-Type": "application/json"}
if self.token:
headers["authorization"] = "Token {}".format(self.token)
req = self.http_session.get(
@@ -213,9 +224,9 @@
def _make_call(self, verb="get", url_override=None, add_params=None,
data=None):
if verb in ("post", "put") or verb == "delete" and data:
- headers = {"Content-Type": "application/json;"}
+ headers = {"Content-Type": "application/json"}
else:
- headers = {"accept": "application/json;"}
+ headers = {"accept": "application/json"}
if self.token:
headers["authorization"] = "Token {}".format(self.token)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-7.0.1/pynetbox/models/dcim.py
new/pynetbox-7.1.0/pynetbox/models/dcim.py
--- old/pynetbox-7.0.1/pynetbox/models/dcim.py 2023-01-23 21:38:54.000000000
+0100
+++ new/pynetbox-7.1.0/pynetbox/models/dcim.py 2023-08-25 23:32:09.000000000
+0200
@@ -17,7 +17,7 @@
from pynetbox.core.query import Request
from pynetbox.core.response import Record, JsonField
-from pynetbox.core.endpoint import RODetailEndpoint
+from pynetbox.core.endpoint import RODetailEndpoint, DetailEndpoint
from pynetbox.models.ipam import IpAddresses
from pynetbox.models.circuits import Circuits
@@ -121,6 +121,23 @@
"""
return RODetailEndpoint(self, "napalm")
+ @property
+ def render_config(self):
+ """
+ Represents the ``render-config`` detail endpoint.
+
+ Returns a DetailEndpoint object that is the interface for
+ viewing response from the render-config endpoint.
+
+ :returns: :py:class:`.DetailEndpoint`
+
+ :Examples:
+
+ >>> device = nb.ipam.devices.get(123)
+ >>> device.render_config.create()
+ """
+ return DetailEndpoint(self, "render-config")
+
class InterfaceConnections(Record):
def __str__(self):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-7.0.1/pynetbox/models/ipam.py
new/pynetbox-7.1.0/pynetbox/models/ipam.py
--- old/pynetbox-7.0.1/pynetbox/models/ipam.py 2023-01-23 21:38:54.000000000
+0100
+++ new/pynetbox-7.1.0/pynetbox/models/ipam.py 2023-08-25 23:32:09.000000000
+0200
@@ -162,3 +162,33 @@
NewVLAN (10)
"""
return DetailEndpoint(self, "available-vlans", custom_return=Vlans)
+
+
+class AsnRanges(Record):
+ @property
+ def available_asns(self):
+ """
+ Represents the ``available-asns`` detail endpoint.
+
+ Returns a DetailEndpoint object that is the interface for
+ viewing and creating ASNs inside an ASN range.
+
+ :returns: :py:class:`.DetailEndpoint`
+
+ :Examples:
+
+ >>> asn_range = nb.ipam.asn_ranges.get(1)
+ >>> asn_range.available_asns.list()
+ [64512, 64513, 64514]
+
+ To create a new ASN:
+
+ >>> asn_range.available_asns.create()
+ 64512
+
+ To create multiple ASNs:
+
+ >>> asn_range.available_asns.create([{} for i in range(2)])
+ [64513, 64514]
+ """
+ return DetailEndpoint(self, "available-asns")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-7.0.1/pynetbox/models/mapper.py
new/pynetbox-7.1.0/pynetbox/models/mapper.py
--- old/pynetbox-7.0.1/pynetbox/models/mapper.py 2023-01-23
21:38:54.000000000 +0100
+++ new/pynetbox-7.1.0/pynetbox/models/mapper.py 2023-08-25
23:32:09.000000000 +0200
@@ -59,7 +59,7 @@
"dcim.poweroutlet": PowerOutlets,
"dcim.poweroutlettemplate": None,
"dcim.powerpanel": None,
- "dcim.powerport": ConsolePorts,
+ "dcim.powerport": PowerPorts,
"dcim.powerporttemplate": None,
"dcim.rack": Racks,
"dcim.rackreservation": RackReservations,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-7.0.1/pynetbox.egg-info/PKG-INFO
new/pynetbox-7.1.0/pynetbox.egg-info/PKG-INFO
--- old/pynetbox-7.0.1/pynetbox.egg-info/PKG-INFO 2023-01-23
21:39:05.000000000 +0100
+++ new/pynetbox-7.1.0/pynetbox.egg-info/PKG-INFO 2023-08-25
23:32:21.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: pynetbox
-Version: 7.0.1
+Version: 7.1.0
Summary: NetBox API client library
Home-page: https://github.com/netbox-community/pynetbox
Author: Zach Moody
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-7.0.1/pynetbox.egg-info/requires.txt
new/pynetbox-7.1.0/pynetbox.egg-info/requires.txt
--- old/pynetbox-7.0.1/pynetbox.egg-info/requires.txt 2023-01-23
21:39:05.000000000 +0100
+++ new/pynetbox-7.1.0/pynetbox.egg-info/requires.txt 2023-08-25
23:32:21.000000000 +0200
@@ -1 +1,2 @@
requests<3.0,>=2.20.0
+packaging<24.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-7.0.1/requirements-dev.txt
new/pynetbox-7.1.0/requirements-dev.txt
--- old/pynetbox-7.0.1/requirements-dev.txt 2023-01-23 21:38:54.000000000
+0100
+++ new/pynetbox-7.1.0/requirements-dev.txt 2023-08-25 23:32:09.000000000
+0200
@@ -1,4 +1,4 @@
black~=22.10
pytest==7.1.*
pytest-docker==1.0.*
-PyYAML==6.0
+PyYAML==6.0.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-7.0.1/requirements.txt
new/pynetbox-7.1.0/requirements.txt
--- old/pynetbox-7.0.1/requirements.txt 2023-01-23 21:38:54.000000000 +0100
+++ new/pynetbox-7.1.0/requirements.txt 2023-08-25 23:32:09.000000000 +0200
@@ -1 +1,2 @@
requests>=2.20.0,<3.0
+packaging<24.0
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-7.0.1/setup.py new/pynetbox-7.1.0/setup.py
--- old/pynetbox-7.0.1/setup.py 2023-01-23 21:38:54.000000000 +0100
+++ new/pynetbox-7.1.0/setup.py 2023-08-25 23:32:09.000000000 +0200
@@ -13,6 +13,7 @@
packages=find_packages(exclude=["tests", "tests.*"]),
install_requires=[
"requests>=2.20.0,<3.0",
+ "packaging<24.0"
],
zip_safe=False,
keywords=["netbox"],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-7.0.1/tests/integration/conftest.py
new/pynetbox-7.1.0/tests/integration/conftest.py
--- old/pynetbox-7.0.1/tests/integration/conftest.py 2023-01-23
21:38:54.000000000 +0100
+++ new/pynetbox-7.1.0/tests/integration/conftest.py 2023-08-25
23:32:09.000000000 +0200
@@ -28,7 +28,11 @@
major, minor = netbox_version.major, netbox_version.minor
if (major, minor) == (3, 3):
- tag = "2.2.0"
+ tag = "2.3.0"
+ elif (major, minor) == (3, 4):
+ tag = "2.5.3"
+ elif (major, minor) == (3, 5):
+ tag = "2.6.1"
else:
raise NotImplementedError(
"Version %s is not currently supported" % netbox_version
@@ -48,7 +52,7 @@
try:
subp.check_call(["which", "git"])
except subp.CalledProcessError:
- pytest.skip(msg="git executable was not found on the host")
+ pytest.skip(reason="git executable was not found on the host")
return (
subp.check_output(["git", "rev-parse", "--show-toplevel"])
.decode("utf-8")
@@ -73,7 +77,7 @@
try:
subp.check_call(["which", "docker"])
except subp.CalledProcessError:
- pytest.skip(msg="docker executable was not found on the host")
+ pytest.skip(reason="docker executable was not found on the host")
netbox_versions_by_repo_dirpaths = {}
for netbox_version in pytestconfig.option.netbox_versions:
repo_version_tag =
get_netbox_docker_version_tag(netbox_version=netbox_version)
@@ -248,6 +252,14 @@
"netboxcommunity/netbox:v%s" % netbox_version
)
+ new_services[new_service_name]["environment"] = {
+ "SKIP_SUPERUSER": "false",
+ "SUPERUSER_API_TOKEN":
"0123456789abcdef0123456789abcdef01234567",
+ "SUPERUSER_EMAIL": "[email protected]",
+ "SUPERUSER_NAME": "admin",
+ "SUPERUSER_PASSWORD": "admin",
+ }
+
if service_name == "netbox":
# ensure the netbox container listens on a random port
new_services[new_service_name]["ports"] = ["8080"]
@@ -341,7 +353,7 @@
def netbox_is_responsive(url):
- """Chack if the HTTP service is up and responsive."""
+ """Check if the HTTP service is up and responsive."""
try:
response = requests.get(url)
if response.status_code == 200:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-7.0.1/tests/test_circuits.py
new/pynetbox-7.1.0/tests/test_circuits.py
--- old/pynetbox-7.0.1/tests/test_circuits.py 2023-01-23 21:38:54.000000000
+0100
+++ new/pynetbox-7.1.0/tests/test_circuits.py 2023-08-25 23:32:09.000000000
+0200
@@ -11,7 +11,7 @@
nb = api.circuits
-HEADERS = {"accept": "application/json;"}
+HEADERS = {"accept": "application/json"}
class Generic:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-7.0.1/tests/test_tenancy.py
new/pynetbox-7.1.0/tests/test_tenancy.py
--- old/pynetbox-7.0.1/tests/test_tenancy.py 2023-01-23 21:38:54.000000000
+0100
+++ new/pynetbox-7.1.0/tests/test_tenancy.py 2023-08-25 23:32:09.000000000
+0200
@@ -11,7 +11,7 @@
nb = api.tenancy
-HEADERS = {"accept": "application/json;"}
+HEADERS = {"accept": "application/json"}
class Generic:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-7.0.1/tests/test_users.py
new/pynetbox-7.1.0/tests/test_users.py
--- old/pynetbox-7.0.1/tests/test_users.py 2023-01-23 21:38:54.000000000
+0100
+++ new/pynetbox-7.1.0/tests/test_users.py 2023-08-25 23:32:09.000000000
+0200
@@ -11,7 +11,7 @@
nb = api.users
-HEADERS = {"accept": "application/json;"}
+HEADERS = {"accept": "application/json"}
class Generic:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-7.0.1/tests/test_virtualization.py
new/pynetbox-7.1.0/tests/test_virtualization.py
--- old/pynetbox-7.0.1/tests/test_virtualization.py 2023-01-23
21:38:54.000000000 +0100
+++ new/pynetbox-7.1.0/tests/test_virtualization.py 2023-08-25
23:32:09.000000000 +0200
@@ -11,7 +11,7 @@
nb = api.virtualization
-HEADERS = {"accept": "application/json;"}
+HEADERS = {"accept": "application/json"}
class Generic:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-7.0.1/tests/test_wireless.py
new/pynetbox-7.1.0/tests/test_wireless.py
--- old/pynetbox-7.0.1/tests/test_wireless.py 2023-01-23 21:38:54.000000000
+0100
+++ new/pynetbox-7.1.0/tests/test_wireless.py 2023-08-25 23:32:09.000000000
+0200
@@ -9,7 +9,7 @@
nb_app = api.wireless
-HEADERS = {"accept": "application/json;"}
+HEADERS = {"accept": "application/json"}
class Generic:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-7.0.1/tests/unit/test_query.py
new/pynetbox-7.1.0/tests/unit/test_query.py
--- old/pynetbox-7.0.1/tests/unit/test_query.py 2023-01-23 21:38:54.000000000
+0100
+++ new/pynetbox-7.1.0/tests/unit/test_query.py 2023-08-25 23:32:09.000000000
+0200
@@ -20,7 +20,7 @@
expected = call(
"http://localhost:8001/api/dcim/devices/",
params={"q": "abcd", "limit": 1},
- headers={"accept": "application/json;"},
+ headers={"accept": "application/json"},
)
test_obj.http_session.get.ok = True
test = test_obj.get_count()
@@ -28,7 +28,7 @@
test_obj.http_session.get.assert_called_with(
"http://localhost:8001/api/dcim/devices/",
params={"q": "abcd", "limit": 1},
- headers={"accept": "application/json;"},
+ headers={"accept": "application/json"},
json=None,
)
@@ -49,7 +49,7 @@
test_obj.http_session.get.assert_called_with(
"http://localhost:8001/api/dcim/devices/",
params={"limit": 1},
- headers={"accept": "application/json;"},
+ headers={"accept": "application/json"},
json=None,
)
@@ -69,7 +69,7 @@
expected = call(
"http://localhost:8001/api/dcim/devices/",
params={"offset": 20, "limit": 10},
- headers={"accept": "application/json;"},
+ headers={"accept": "application/json"},
)
test_obj.http_session.get.ok = True
generator = test_obj.get()
@@ -77,6 +77,6 @@
test_obj.http_session.get.assert_called_with(
"http://localhost:8001/api/dcim/devices/",
params={"offset": 20, "limit": 10},
- headers={"accept": "application/json;"},
+ headers={"accept": "application/json"},
json=None,
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-7.0.1/tests/unit/test_request.py
new/pynetbox-7.1.0/tests/unit/test_request.py
--- old/pynetbox-7.0.1/tests/unit/test_request.py 2023-01-23
21:38:54.000000000 +0100
+++ new/pynetbox-7.1.0/tests/unit/test_request.py 2023-08-25
23:32:09.000000000 +0200
@@ -5,10 +5,32 @@
class RequestTestCase(unittest.TestCase):
- def test_get_openapi(self):
+ def test_get_openapi_version_less_than_3_5(self):
test = Request("http://localhost:8080/api", Mock())
+ test.get_version = Mock(return_value="3.4")
+
+ # Mock the HTTP response
+ response_mock = Mock()
+ response_mock.ok = True
+ test.http_session.get.return_value = response_mock
+
test.get_openapi()
test.http_session.get.assert_called_with(
"http://localhost:8080/api/docs/?format=openapi",
- headers={"Content-Type": "application/json;"},
+ headers={"Accept": "application/json", "Content-Type":
"application/json"},
+ )
+
+ def test_get_openapi_version_3_5_or_greater(self):
+ test = Request("http://localhost:8080/api", Mock())
+ test.get_version = Mock(return_value="3.5")
+
+ # Mock the HTTP response
+ response_mock = Mock()
+ response_mock.ok = True
+ test.http_session.get.return_value = response_mock
+
+ test.get_openapi()
+ test.http_session.get.assert_called_with(
+ "http://localhost:8080/api/schema/",
+ headers={"Accept": "application/json", "Content-Type":
"application/json"},
)