diff --git a/.github/workflows/py3pr.yml b/.github/workflows/py3pr.yml index 2e5ecdfd..af956a94 100644 --- a/.github/workflows/py3pr.yml +++ b/.github/workflows/py3pr.yml @@ -19,10 +19,10 @@ jobs: 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 --git a/pynetbox/core/response.py b/pynetbox/core/response.py index b8cac5a0..b5e582a3 100644 --- a/pynetbox/core/response.py +++ b/pynetbox/core/response.py @@ -382,7 +382,7 @@ def save(self): 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 @@ def delete(self): >>> """ 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 --git a/tests/unit/test_response.py b/tests/unit/test_response.py index f5495f90..44761e8b 100644 --- a/tests/unit/test_response.py +++ b/tests/unit/test_response.py @@ -214,7 +214,7 @@ def test_nested_write(self): "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 @@ def test_nested_write(self): 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):