We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 02b2149 + 4189248 commit 317cc9dCopy full SHA for 317cc9d
tests/fixtures/api/get_session_key.json
@@ -0,0 +1,3 @@
1
+{
2
+ "session_key": "ansodicnaoiwenafoi="
3
+}
tests/test_api.py
@@ -0,0 +1,25 @@
+import unittest
+import six
+
4
+from .util import Response
5
+import pynetbox
6
7
+if six.PY3:
8
+ from unittest.mock import patch
9
+else:
10
+ from mock import patch
11
12
13
+class ApiTestCase(unittest.TestCase):
14
+ @patch(
15
+ 'pynetbox.lib.query.requests.post',
16
+ return_value=Response(fixture='api/get_session_key.json')
17
+ )
18
+ def test_get(self, mock):
19
+ api = pynetbox.api(
20
+ "http://localhost:8000",
21
+ token='abc123',
22
+ private_key_file='tests/fixtures/api/get_session_key.json',
23
+ version='2.0'
24
25
+ self.assertTrue(api)
0 commit comments