Skip to content

Commit

Permalink
Merge pull request #20 from digitalocean/api-test
Browse files Browse the repository at this point in the history
api test
  • Loading branch information
Zach Moody committed Nov 17, 2017
2 parents 02b2149 + 4189248 commit 317cc9d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/fixtures/api/get_session_key.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"session_key": "ansodicnaoiwenafoi="
}
25 changes: 25 additions & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import unittest
import six

from .util import Response
import pynetbox

if six.PY3:
from unittest.mock import patch
else:
from mock import patch


class ApiTestCase(unittest.TestCase):
@patch(
'pynetbox.lib.query.requests.post',
return_value=Response(fixture='api/get_session_key.json')
)
def test_get(self, mock):
api = pynetbox.api(
"http://localhost:8000",
token='abc123',
private_key_file='tests/fixtures/api/get_session_key.json',
version='2.0'
)
self.assertTrue(api)

0 comments on commit 317cc9d

Please sign in to comment.