def test_get_secret(self): with patch("pynetbox.api", MagicMock()) as mock: with patch.dict(netbox.__utils__, {"args.clean_kwargs": mocked_clean_kwargs_get}): netbox.get_("secrets", "secrets", name="test") self.assertTrue("token" and "private_key_file" in mock.call_args[1])
def test_get_by_name(self): with patch("pynetbox.api", MagicMock()) as mock: with patch.dict(netbox.__utils__, {"args.clean_kwargs": mocked_clean_kwargs_get}): netbox.get_("dcim", "devices", name="test") self.assertEqual(mock.mock_calls[1], call().dcim.devices.get(name="test"))
def test_token_present(self): with patch("pynetbox.api", MagicMock()) as mock: with patch.dict( netbox.__utils__, {"args.clean_kwargs": mocked_clean_kwargs_get} ): netbox.get_("dcim", "devices", name="test") self.assertTrue("token" in mock.call_args[1])
def test_get_secret(self): with patch('pynetbox.api', MagicMock()) as mock: with patch.dict(netbox.__utils__, {'args.clean_kwargs': mocked_clean_kwargs_get}): netbox.get_('secrets', 'secrets', name='test') self.assertTrue( 'token' and 'private_key_file' in mock.call_args[1] )
def test_token_present(self): with patch('pynetbox.api', MagicMock()) as mock: with patch.dict(netbox.__utils__, {'args.clean_kwargs': mocked_clean_kwargs_get}): netbox.get_('dcim', 'devices', name='test') self.assertTrue( 'token' in mock.call_args[1] )
def test_get_by_name(self): with patch('pynetbox.api', MagicMock()) as mock: with patch.dict(netbox.__utils__, {'args.clean_kwargs': mocked_clean_kwargs_get}): netbox.get_('dcim', 'devices', name='test') self.assertEqual( mock.mock_calls[1], call().dcim.devices.get(name='test') )