Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
nb = api.dcim
HEADERS = {
'accept': 'application/json;',
}
AUTH_HEADERS = {
'accept': 'application/json;',
'authorization': 'Token None',
}
class Generic(object):
class Tests(unittest.TestCase):
name = ''
ret = pynetbox.core.response.Record
app = 'dcim'
def test_get_all(self):
with patch(
'pynetbox.core.query.requests.sessions.Session.get',
return_value=Response(fixture='{}/{}.json'.format(
self.app,
self.name
))
) as mock:
ret = getattr(nb, self.name).all()
self.assertTrue(ret)
self.assertTrue(isinstance(ret, list))
self.assertTrue(isinstance(ret[0], self.ret))
mock.assert_called_with(
'http://localhost:8000/api/{}/{}/'.format(
api = pynetbox.api(
"http://localhost:8000",
)
nb = api.tenancy
HEADERS = {
'accept': 'application/json;'
}
class Generic(object):
class Tests(unittest.TestCase):
name = ''
ret = pynetbox.core.response.Record
app = 'tenancy'
def test_get_all(self):
with patch(
'pynetbox.core.query.requests.sessions.Session.get',
return_value=Response(fixture='{}/{}.json'.format(
self.app,
self.name
))
) as mock:
ret = getattr(nb, self.name).all()
self.assertTrue(ret)
self.assertTrue(isinstance(ret, list))
self.assertTrue(isinstance(ret[0], self.ret))
mock.assert_called_with(
'http://localhost:8000/api/{}/{}/'.format(
api = pynetbox.api(
"http://localhost:8000",
)
nb = api.virtualization
HEADERS = {
'accept': 'application/json;'
}
class Generic(object):
class Tests(unittest.TestCase):
name = ''
ret = pynetbox.core.response.Record
app = 'virtualization'
def test_get_all(self):
with patch(
'pynetbox.core.query.requests.sessions.Session.get',
return_value=Response(fixture='{}/{}.json'.format(
self.app,
self.name
))
) as mock:
ret = getattr(nb, self.name).all()
self.assertTrue(ret)
self.assertTrue(isinstance(ret, list))
self.assertTrue(isinstance(ret[0], self.ret))
mock.assert_called_with(
'http://localhost:8000/api/{}/{}/'.format(
api = pynetbox.api(
"http://localhost:8000",
)
nb = api.circuits
HEADERS = {
'accept': 'application/json;'
}
class Generic(object):
class Tests(unittest.TestCase):
name = ''
ret = pynetbox.core.response.Record
app = 'circuits'
def test_get_all(self):
with patch(
'pynetbox.core.query.requests.sessions.Session.get',
return_value=Response(fixture='{}/{}.json'.format(
self.app,
self.name
))
) as mock:
ret = getattr(nb, self.name).all()
self.assertTrue(ret)
self.assertTrue(isinstance(ret, list))
self.assertTrue(isinstance(ret[0], self.ret))
mock.assert_called_with(
'http://localhost:8000/api/{}/{}/'.format(
HEADERS = {
'accept': 'application/json;',
'authorization': 'Token abc123',
}
POST_HEADERS = {
'Content-Type': 'application/json;',
'authorization': 'Token abc123',
}
class Generic(object):
class Tests(unittest.TestCase):
name = ''
name_singular = None
ret = pynetbox.core.response.Record
app = 'ipam'
def test_get_all(self):
with patch(
'pynetbox.core.query.requests.sessions.Session.get',
return_value=Response(fixture='{}/{}.json'.format(
self.app,
self.name
))
) as mock:
ret = getattr(nb, self.name).all()
self.assertTrue(ret)
self.assertTrue(isinstance(ret, list))
self.assertTrue(isinstance(ret[0], self.ret))
mock.assert_called_with(
'http://localhost:8000/api/{}/{}/'.format(