@@ -0,0 +1,1098 @@
+import unittest2 as unittest%0Afrom nose.plugins.attrib import attr%0Afrom mock import MagicMock, patch%0Afrom jnpr.junos.transport.tty_telnet import Telnet%0A%0A%0A@attr('unit')%0Aclass TestTTYTelnet(unittest.TestCase):%0A%0A    @patch('jnpr.junos.transport.tty_telnet.telnetlib.Telnet')%0A    def setUp(self, mpock_telnet):%0A        self.tel_conn = Telnet(host='1.1.1.1', user='test',%0A                               password='password123', port=23,%0A                               timeout=30)%0A%0A    def test_open(self):%0A        self.tel_conn._tty_open()%0A        self.tel_conn._tn.open.assert_called()%0A%0A    def test_open_exception(self):%0A        self.tel_conn._tn.open.side_effect = Exception%0A        Telnet.RETRY_OPEN = 1%0A        Telnet.RETRY_BACKOFF = 0.1%0A        self.assertRaises(RuntimeError, self.tel_conn._tty_open)%0A        # reset%0A        Telnet.RETRY_OPEN = 3%0A        Telnet.RETRY_BACKOFF = 2%0A%0A    def test_close(self):%0A        self.tel_conn._tty_close()%0A        self.tel_conn._tn.close.assert_called()%0A%0A    def test_read(self):%0A        self.tel_conn.read()%0A        self.tel_conn._tn.read_until.assert_called()%0A

test cases for tty telnet