def test_delete(self):
with patch(
'pynetbox.lib.query.requests.get',
return_value=Response(fixture='{}/{}.json'.format(
self.app,
self.name[:-1]
))
) as mock, patch('pynetbox.lib.query.requests.delete') as delete:
ret = getattr(nb, self.name).get(1)
self.assertTrue(ret.delete())
mock.assert_called_with(
'http://localhost:8000/api/{}/{}/1/'.format(
self.app,
self.name.replace('_', '-')
),
headers=HEADERS
)
delete.assert_called_with(
'http://localhost:8000/api/{}/{}/1/'.format(
self.app,
self.name.replace('_', '-')
),
headers=AUTH_HEADERS
)
评论列表
文章目录