Skip to content

Commit 70b88e8

Browse files
author
Zach Moody
authored
Merge pull request #85 from digitalocean/fix-circuit-term-repr
Fix circuit term repr
2 parents f450ebf + 111185e commit 70b88e8

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

pynetbox/circuits.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,9 @@ class Circuits(Record):
2020

2121
def __str__(self):
2222
return self.cid
23+
24+
25+
class CircuitTerminations(Record):
26+
27+
def __str__(self):
28+
return self.circuit.cid

tests/test_circuits.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,11 @@ class CircuitTypeTestCase(unittest.TestCase, GenericTest):
111111

112112
class CircuitTerminationsTestCase(unittest.TestCase, GenericTest):
113113
name = 'circuit_terminations'
114+
115+
@patch(
116+
'pynetbox.lib.query.requests.get',
117+
return_value=Response(fixture='circuits/circuit_termination.json')
118+
)
119+
def test_repr(self, _):
120+
test = nb.circuit_terminations.get(1)
121+
self.assertEqual(str(test), '123456')

0 commit comments

Comments
 (0)