<s> import unittest <EOL> from flexmock import flexmock_teardown <EOL> from tests . dell import enable , assert_running_config_contains_in_order , configuring_vlan , configuring_interface_vlan , unconfigure_vlan , ssh_protocol_factory , telnet_protocol_factory , configuring_a_vlan_on_interface , configuring_interface <EOL> from tests . util . protocol_util import with_protocol <EOL> class DellEnabledTest ( unittest . TestCase ) : <EOL> __test__ = False <EOL> protocol_factory = ssh_protocol_factory <EOL> def setUp ( self ) : <EOL> self . protocol = self . protocol_factory ( ) <EOL> def tearDown ( self ) : <EOL> flexmock_teardown ( ) <EOL> @ with_protocol <EOL> def test_exit_returns_to_unprivileged_mode ( self , t ) : <EOL> enable ( t ) <EOL> t . write ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . read ( "<STR_LIT>" ) <EOL> @ with_protocol <EOL> def test_quit_disconnects ( self , t ) : <EOL> enable ( t ) <EOL> t . write ( "<STR_LIT>" ) <EOL> t . read_eof ( ) <EOL> @ with_protocol <EOL> def test_write_memory ( self , t ) : <EOL> enable ( t ) <EOL> t . write ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . read ( "<STR_LIT>" ) <EOL> t . write_raw ( "<STR_LIT:y>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . read ( "<STR_LIT>" ) <EOL> @ with_protocol <EOL> def test_write_memory_abort ( self , t ) : <EOL> enable ( t ) <EOL> t . write ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . read ( "<STR_LIT>" ) <EOL> t . write_raw ( "<STR_LIT:n>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . read ( "<STR_LIT>" ) <EOL> @ with_protocol <EOL> def test_write_memory_any_other_key_aborts ( self , t ) : <EOL> enable ( t ) <EOL> t . write ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . read ( "<STR_LIT>" ) <EOL> t . write_raw ( "<STR_LIT:p>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . read ( "<STR_LIT>" ) <EOL> @ with_protocol <EOL> def test_invalid_command ( self , t ) : <EOL> enable ( t ) <EOL> t . write ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> @ with_protocol <EOL> def test_entering_configure_mode ( self , t ) : <EOL> enable ( t ) <EOL> t . write ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . read ( "<STR_LIT>" ) <EOL> t . write ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . read ( "<STR_LIT>" ) <EOL> @ with_protocol <EOL> def test_show_running_config_on_empty_ethernet_port ( self , t ) : <EOL> enable ( t ) <EOL> t . write ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . read ( "<STR_LIT>" ) <EOL> @ with_protocol <EOL> def test_show_running_config_on_ethernet_port_that_does_not_exists ( self , t ) : <EOL> enable ( t ) <EOL> t . write ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . read ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . read ( "<STR_LIT>" ) <EOL> @ with_protocol <EOL> def test_show_running_config_displays_header ( self , t ) : <EOL> enable ( t ) <EOL> assert_running_config_contains_in_order ( t , [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:!>' , <EOL> '<STR_LIT>' , <EOL> ] ) <EOL> @ with_protocol <EOL> def test_show_vlan ( self , t ) : <EOL> enable ( t ) <EOL> configuring_vlan ( t , <NUM_LIT:10> ) <EOL> configuring_vlan ( t , <NUM_LIT:11> ) <EOL> configuring_vlan ( t , <NUM_LIT:12> ) <EOL> configuring_vlan ( t , <NUM_LIT> ) <EOL> configuring_vlan ( t , <NUM_LIT> ) <EOL> configuring_vlan ( t , <NUM_LIT:15> ) <EOL> configuring_vlan ( t , <NUM_LIT:16> ) <EOL> configuring_vlan ( t , <NUM_LIT> ) <EOL> configuring_interface_vlan ( t , <NUM_LIT> , do = "<STR_LIT>" ) <EOL> configuring_vlan ( t , <NUM_LIT> ) <EOL> configuring_vlan ( t , <NUM_LIT> ) <EOL> configuring_vlan ( t , <NUM_LIT:20> ) <EOL> configuring_vlan ( t , <NUM_LIT> ) <EOL> configuring_vlan ( t , <NUM_LIT> ) <EOL> configuring_vlan ( t , <NUM_LIT> ) <EOL> configuring_vlan ( t , <NUM_LIT> ) <EOL> configuring_vlan ( t , <NUM_LIT> ) <EOL> configuring_vlan ( t , <NUM_LIT> ) <EOL> configuring_vlan ( t , <NUM_LIT> ) <EOL> configuring_vlan ( t , <NUM_LIT> ) <EOL> configuring_vlan ( t , <NUM_LIT> ) <EOL> configuring_vlan ( t , <NUM_LIT> ) <EOL> configuring_vlan ( t , <NUM_LIT> ) <EOL> configuring_interface_vlan ( t , <NUM_LIT> , do = "<STR_LIT>" ) <EOL> t . write ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . read ( "<STR_LIT>" ) <EOL> t . write_raw ( "<STR_LIT:m>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . read ( "<STR_LIT>" ) <EOL> unconfigure_vlan ( t , <NUM_LIT:10> ) <EOL> unconfigure_vlan ( t , <NUM_LIT:11> ) <EOL> unconfigure_vlan ( t , <NUM_LIT:12> ) <EOL> unconfigure_vlan ( t , <NUM_LIT> ) <EOL> unconfigure_vlan ( t , <NUM_LIT> ) <EOL> unconfigure_vlan ( t , <NUM_LIT:15> ) <EOL> unconfigure_vlan ( t , <NUM_LIT:16> ) <EOL> unconfigure_vlan ( t , <NUM_LIT> ) <EOL> unconfigure_vlan ( t , <NUM_LIT> ) <EOL> unconfigure_vlan ( t , <NUM_LIT> ) <EOL> unconfigure_vlan ( t , <NUM_LIT:20> ) <EOL> unconfigure_vlan ( t , <NUM_LIT> ) <EOL> unconfigure_vlan ( t , <NUM_LIT> ) <EOL> unconfigure_vlan ( t , <NUM_LIT> ) <EOL> unconfigure_vlan ( t , <NUM_LIT> ) <EOL> unconfigure_vlan ( t , <NUM_LIT> ) <EOL> unconfigure_vlan ( t , <NUM_LIT> ) <EOL> unconfigure_vlan ( t , <NUM_LIT> ) <EOL> unconfigure_vlan ( t , <NUM_LIT> ) <EOL> unconfigure_vlan ( t , <NUM_LIT> ) <EOL> unconfigure_vlan ( t , <NUM_LIT> ) <EOL> unconfigure_vlan ( t , <NUM_LIT> ) <EOL> @ with_protocol <EOL> def test_show_vlan_id ( self , t ) : <EOL> enable ( t ) <EOL> configuring_vlan ( t , <NUM_LIT:1000> ) <EOL> t . write ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . read ( "<STR_LIT>" ) <EOL> t . write ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . read ( "<STR_LIT>" ) <EOL> t . write ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . read ( "<STR_LIT>" ) <EOL> t . write ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . read ( "<STR_LIT>" ) <EOL> unconfigure_vlan ( t , <NUM_LIT:1000> ) <EOL> @ with_protocol <EOL> def test_show_vlan_id_with_ports ( self , t ) : <EOL> enable ( t ) <EOL> configuring_vlan ( t , <NUM_LIT:1000> ) <EOL> configuring_interface ( t , "<STR_LIT>" , do = "<STR_LIT>" ) <EOL> configuring_a_vlan_on_interface ( t , "<STR_LIT>" , do = "<STR_LIT>" ) <EOL> t . write ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . read ( "<STR_LIT>" ) <EOL> configuring_interface ( t , "<STR_LIT>" , do = "<STR_LIT>" ) <EOL> t . write ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . read ( "<STR_LIT>" ) <EOL> configuring_a_vlan_on_interface ( t , "<STR_LIT>" , do = "<STR_LIT>" ) <EOL> configuring_interface ( t , "<STR_LIT>" , do = "<STR_LIT>" ) <EOL> configuring_a_vlan_on_interface ( t , "<STR_LIT>" , do = "<STR_LIT>" ) <EOL> t . write ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . read ( "<STR_LIT>" ) <EOL> configuring_interface ( t , "<STR_LIT>" , do = "<STR_LIT>" ) <EOL> configuring_a_vlan_on_interface ( t , "<STR_LIT>" , do = "<STR_LIT>" ) <EOL> t . write ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . read ( "<STR_LIT>" ) <EOL> configuring_interface ( t , "<STR_LIT>" , do = "<STR_LIT>" ) <EOL> configuring_interface ( t , "<STR_LIT>" , do = "<STR_LIT>" ) <EOL> configuring_interface ( t , "<STR_LIT>" , do = "<STR_LIT>" ) <EOL> unconfigure_vlan ( t , <NUM_LIT:1000> ) <EOL> @ with_protocol <EOL> def test_show_version ( self , t ) : <EOL> enable ( t ) <EOL> t . write ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . readln ( "<STR_LIT>" ) <EOL> t . read ( "<STR_LIT>" ) <EOL> class DellEnabledSshTest ( DellEnabledTest ) : <EOL> __test__ = True <EOL> protocol_factory = ssh_protocol_factory <EOL> class DellEnabledTelnetTest ( DellEnabledTest ) : <EOL> __test__ = True <EOL> protocol_factory = telnet_protocol_factory </s>
