How to use the pynetbox.core.endpoint.Endpoint function in pynetbox

To help you get started, we’ve selected a few pynetbox examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github digitalocean / pynetbox / tests / unit / test_endpoint.py View on Github external
def test_filter_reserved_kwargs(self):

        api = Mock(base_url="http://localhost:8000/api")
        app = Mock(name="test")
        test_obj = Endpoint(api, app, "test")
        with self.assertRaises(ValueError) as _:
            test_obj.filter(id=1)
github digitalocean / pynetbox / tests / unit / test_endpoint.py View on Github external
def test_filter_empty_kwargs(self):

        api = Mock(base_url="http://localhost:8000/api")
        app = Mock(name="test")
        test_obj = Endpoint(api, app, "test")
        with self.assertRaises(ValueError) as _:
            test_obj.filter()
github digitalocean / pynetbox / tests / unit / test_endpoint.py View on Github external
def test_filter(self):
        with patch(
            "pynetbox.core.query.Request.get", return_value=Mock()
        ) as mock:
            api = Mock(base_url="http://localhost:8000/api")
            app = Mock(name="test")
            mock.return_value = [{'id': 123}, {'id': 321}]
            test_obj = Endpoint(api, app, "test")
            test = test_obj.filter(test="test")
            self.assertEqual(len(test), 2)
github digitalocean / pynetbox / pynetbox / api.py View on Github external
def __getattr__(self, name):
        return Endpoint(self.api, self, name, model=self.model)