Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pynetbox/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
'''
from pynetbox.lib import Endpoint, Request
from pynetbox import dcim, ipam, virtualization
from pynetbox import dcim, ipam, virtualization, circuits


class App(object):
Expand Down Expand Up @@ -119,7 +119,7 @@ def __init__(self, url, token=None, private_key=None,

self.dcim = App(dcim, api_kwargs=self.api_kwargs)
self.ipam = App(ipam, api_kwargs=self.api_kwargs)
self.circuits = App('circuits', api_kwargs=self.api_kwargs)
self.circuits = App(circuits, api_kwargs=self.api_kwargs)
self.secrets = App('secrets', api_kwargs=self.api_kwargs)
self.tenancy = App('tenancy', api_kwargs=self.api_kwargs)
self.extras = App('extras', api_kwargs=self.api_kwargs)
Expand Down
22 changes: 22 additions & 0 deletions pynetbox/circuits.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'''
(c) 2017 DigitalOcean

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
'''
from pynetbox.lib.response import Record


class Circuits(Record):

def __str__(self):
return self.cid
8 changes: 8 additions & 0 deletions tests/test_circuits.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ def test_get(self):
class CircuitsTestCase(unittest.TestCase, GenericTest):
name = 'circuits'

@patch(
'pynetbox.lib.query.requests.get',
return_value=Response(fixture='circuits/circuit.json')
)
def test_repr(self, _):
test = nb.circuits.get(1)
self.assertEqual(str(test), '123456')


class ProviderTestCase(unittest.TestCase, GenericTest):
name = 'providers'
Expand Down