diff --git a/tests/unit/test_exception.py b/tests/unit/test_exception.py index ef7e49194..366355321 100644 --- a/tests/unit/test_exception.py +++ b/tests/unit/test_exception.py @@ -3,7 +3,8 @@ import unittest from nose.plugins.attrib import attr -from jnpr.junos.exception import RpcError, CommitError +from jnpr.junos.exception import RpcError, CommitError, ConnectError +from jnpr.junos import Device from lxml import etree @@ -17,7 +18,16 @@ def test_rpcerror_repr(self): self.assertEqual(obj.__repr__(), '\n test\n\n') def test_rpcerror_jxml_check(self): - #this test is intended to hit jxml code + # this test is intended to hit jxml code rsp = etree.XML('test') obj = CommitError(rsp=rsp) self.assertEqual(type(obj.rpc_error), dict) + + def test_ConnectError(self): + self.dev = Device(host='1.1.1.1', user='rick', password='password123', + gather_facts=False) + obj = ConnectError(self.dev) + self.assertEqual(obj.user, 'rick') + self.assertEqual(obj.host, '1.1.1.1') + self.assertEqual(obj.port, 830) + self.assertEqual(repr(obj), 'ConnectError(1.1.1.1)') diff --git a/tests/unit/test_rpcmeta.py b/tests/unit/test_rpcmeta.py index 952e4bff7..c7a105479 100644 --- a/tests/unit/test_rpcmeta.py +++ b/tests/unit/test_rpcmeta.py @@ -59,3 +59,10 @@ def test_rpcmeta_exec_rpc_kvargs(self, mock_execute_fn): self.rpc.system_users_information(set_data=('test',)) self.assertEqual(mock_execute_fn.call_args[0][0][0].text, 'test') + + @patch('jnpr.junos.device.Device.execute') + def test_rpcmeta_get_config(self, mock_execute_fn): + root = etree.XML('test') + self.rpc.get_config(root) + self.assertEqual(mock_execute_fn.call_args[0][0].tag, + 'get-configuration')