Skip to content

Commit

Permalink
Add test for Api.status()
Browse files Browse the repository at this point in the history
  • Loading branch information
markkuleinio committed Dec 27, 2020
1 parent 6c1d1e2 commit 7e5f473
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,20 @@ class ResponseHeadersWithoutVersion:
def test_api_version_not_found(self, *_):
api = pynetbox.api(host,)
self.assertEqual(api.version, "")


class ApiStatusTestCase(unittest.TestCase):
class ResponseWithStatus:
ok = True
def json(self):
return {
"netbox-version": "0.9.9",
}

@patch(
"pynetbox.core.query.requests.sessions.Session.get",
return_value=ResponseWithStatus(),
)
def test_api_status(self, *_):
api = pynetbox.api(host,)
self.assertEqual(api.status()["netbox-version"], "0.9.9")

0 comments on commit 7e5f473

Please sign in to comment.