From 1cd622e219ceed9ba669bb373a4e4407a9542215 Mon Sep 17 00:00:00 2001 From: Roberto Berto Date: Wed, 13 Dec 2023 01:41:24 -0300 Subject: feature: - configure_set - configure_delete - config_file_save - config_file_load --- tests/test_vy_device.py | 54 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/test_vy_device.py b/tests/test_vy_device.py index 5b7070a..b101c1d 100644 --- a/tests/test_vy_device.py +++ b/tests/test_vy_device.py @@ -10,7 +10,7 @@ import pprint load_dotenv() hostname = os.getenv('VYDEVICE_HOSTNAME') -key = os.getenv('VYDEVICE_KEY') +apikey = os.getenv('VYDEVICE_APIKEY') port = os.getenv('VYDEVICE_PORT') protocol = os.getenv('VYDEVICE_PROTOCOL') verify = os.getenv('VYDEVICE_VERIFY_SSL') @@ -20,18 +20,64 @@ else: verify = True - class TestVyDevice(unittest.TestCase): def setUp(self): - self.device = VyDevice(hostname=hostname, key=key, port=port, protocol=protocol, verify=verify) + self.device = VyDevice(hostname=hostname, apikey=apikey, port=port, protocol=protocol, verify=verify) - def test_show_configuration_content(self): + def test_001_retrieve_show_config(self): response = self.device.retrieve_show_config(['system']) + pprint.pprint(response) + + self.assertEqual(response.status, 200) + self.assertIsNotNone(response.result) + self.assertFalse(response.error) + + def test_010_configure_set_interface(self): + response = self.device.configure_set(path=["interfaces", "dummy", "dum1", "address", "192.168.140.1/24"]) + #pprint.pprint(response) + + self.assertEqual(response.status, 200) + self.assertIsNone(response.result) + self.assertFalse(response.error) + + + def test_011_configure_delete_interface(self): + response = self.device.configure_delete(path=["interfaces", "dummy", "dum1"]) + pprint.pprint(response) + + self.assertEqual(response.status, 200) + self.assertIsNone(response.result) + self.assertFalse(response.error) + + + def test_300_config_file_save(self): + response = self.device.config_file_save(file="/config/test300.config") + pprint.pprint(response) self.assertEqual(response.status, 200) self.assertIsNotNone(response.result) self.assertFalse(response.error) + def test_301_config_file_save(self): + response = self.device.config_file_save() + pprint.pprint(response) + + self.assertEqual(response.status, 200) + self.assertIsNotNone(response.result) + self.assertFalse(response.error) + + + def test_302_config_file_load(self): + response = self.device.config_file_load(file="/config/test300.config") + pprint.pprint(response) + + self.assertEqual(response.status, 200) + self.assertIsNone(response.result) + self.assertFalse(response.error) + + + + def tearDown(self): pass -- cgit v1.2.3