Hello community,

here is the log from the commit of package python-pynetbox for openSUSE:Factory 
checked in at 2020-12-17 17:04:13
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pynetbox (Old)
 and      /work/SRC/openSUSE:Factory/.python-pynetbox.new.5145 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-pynetbox"

Thu Dec 17 17:04:13 2020 rev:17 rq:856321 version:5.1.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pynetbox/python-pynetbox.changes  
2020-10-02 17:34:03.974622798 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-pynetbox.new.5145/python-pynetbox.changes    
    2020-12-17 17:08:31.721924622 +0100
@@ -1,0 +2,6 @@
+Tue Dec 15 21:31:08 UTC 2020 - Martin Hauke <[email protected]>
+
+- Update to version 5.1.1
+  * Fixes bug with where URL was mangled calling .save()
+
+-------------------------------------------------------------------

Old:
----
  pynetbox-5.1.0.tar.gz

New:
----
  pynetbox-5.1.1.tar.gz

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

Other differences:
------------------
++++++ python-pynetbox.spec ++++++
--- /var/tmp/diff_new_pack.cf7nNY/_old  2020-12-17 17:08:32.229925126 +0100
+++ /var/tmp/diff_new_pack.cf7nNY/_new  2020-12-17 17:08:32.229925126 +0100
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-pynetbox
-Version:        5.1.0
+Version:        5.1.1
 Release:        0
 Summary:        NetBox API client library
 License:        Apache-2.0

++++++ pynetbox-5.1.0.tar.gz -> pynetbox-5.1.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-5.1.0/PKG-INFO new/pynetbox-5.1.1/PKG-INFO
--- old/pynetbox-5.1.0/PKG-INFO 2020-09-24 16:26:06.181355700 +0200
+++ new/pynetbox-5.1.1/PKG-INFO 2020-12-15 22:28:50.752257000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pynetbox
-Version: 5.1.0
+Version: 5.1.1
 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.1.0/pynetbox/core/response.py 
new/pynetbox-5.1.1/pynetbox/core/response.py
--- old/pynetbox-5.1.0/pynetbox/core/response.py        2020-09-24 
16:25:58.000000000 +0200
+++ new/pynetbox-5.1.1/pynetbox/core/response.py        2020-12-15 
22:28:34.000000000 +0100
@@ -280,7 +280,11 @@
             setattr(self, k, v)
 
     def _endpoint_from_url(self, url):
-        app, name = urlsplit(url).path.split("/")[2:4]
+        # Remove the base URL from the beginning
+        url = url[len(self.api.base_url):]
+        if url.startswith("/"):
+            url = url[1:]
+        app, name = urlsplit(url).path.split("/")[:2]
         return getattr(pynetbox.core.app.App(self.api, app), name)
 
     def full_details(self):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-5.1.0/pynetbox.egg-info/PKG-INFO 
new/pynetbox-5.1.1/pynetbox.egg-info/PKG-INFO
--- old/pynetbox-5.1.0/pynetbox.egg-info/PKG-INFO       2020-09-24 
16:26:05.000000000 +0200
+++ new/pynetbox-5.1.1/pynetbox.egg-info/PKG-INFO       2020-12-15 
22:28:50.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pynetbox
-Version: 5.1.0
+Version: 5.1.1
 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.1.0/tests/unit/test_response.py 
new/pynetbox-5.1.1/tests/unit/test_response.py
--- old/pynetbox-5.1.0/tests/unit/test_response.py      2020-09-24 
16:25:58.000000000 +0200
+++ new/pynetbox-5.1.1/tests/unit/test_response.py      2020-12-15 
22:28:34.000000000 +0100
@@ -227,14 +227,57 @@
             "http://localhost:8080/api/test-app/test-endpoint/321/";,
         )
 
+    def test_nested_write_with_directory_in_base_url(self):
+        app = Mock()
+        app.token = "abc123"
+        app.base_url = "http://localhost:8080/testing/api";
+        endpoint = Mock()
+        endpoint.name = "test-endpoint"
+        test = Record(
+            {
+                "id": 123,
+                "name": "test",
+                "child": {
+                    "id": 321,
+                    "name": "test123",
+                    "url": 
"http://localhost:8080/testing/api/test-app/test-endpoint/321/";,
+                },
+            },
+            app,
+            endpoint,
+        )
+        test.child.name = "test321"
+        test.child.save()
+        self.assertEqual(
+            app.http_session.patch.call_args[0][0],
+            "http://localhost:8080/testing/api/test-app/test-endpoint/321/";,
+        )
+
     def test_endpoint_from_url(self):
+        api = Mock()
+        api.base_url = "http://localhost:8080/api";
         test = Record(
             {
                 "id": 123,
                 "name": "test",
                 "url": "http://localhost:8080/api/test-app/test-endpoint/1/";,
             },
-            Mock(),
+            api,
+            None,
+        )
+        ret = test._endpoint_from_url(test.url)
+        self.assertEqual(ret.name, "test-endpoint")
+
+    def test_endpoint_from_url_with_directory_in_base_url(self):
+        api = Mock()
+        api.base_url = "http://localhost:8080/testing/api";
+        test = Record(
+            {
+                "id": 123,
+                "name": "test",
+                "url": 
"http://localhost:8080/testing/api/test-app/test-endpoint/1/";,
+            },
+            api,
             None,
         )
         ret = test._endpoint_from_url(test.url)
_______________________________________________
openSUSE Commits mailing list -- [email protected]
To unsubscribe, email [email protected]
List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette
List Archives: 
https://lists.opensuse.org/archives/list/[email protected]

Reply via email to