Example #1
0
    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(offset=1)
Example #2
0
 def test_filter(self):
     with patch("pynetbox.core.query.Request._make_call",
                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)