<s> import unittest <EOL> from hamcrest import assert_that , equal_to <EOL> import mock <EOL> from fake_switches . command_processing . switch_tftp_parser import SwitchTftpParser <EOL> from fake_switches . cisco . command_processor . config import ConfigCommandProcessor <EOL> from fake_switches . switch_configuration import SwitchConfiguration , Port <EOL> class TestCiscoSwitchTftpParsing ( unittest . TestCase ) : <EOL> @ mock . patch ( "<STR_LIT>" ) <EOL> def test_basic_parsing ( self , tftp_reader_mock ) : <EOL> tftp_reader_mock . return_value = """<STR_LIT>""" <EOL> config = SwitchConfiguration ( "<STR_LIT:127.0.0.1>" , name = "<STR_LIT>" , ports = [ <EOL> Port ( "<STR_LIT>" ) <EOL> ] ) <EOL> parser = SwitchTftpParser ( config ) <EOL> parser . parse ( "<STR_LIT>" , "<STR_LIT:filename>" , ConfigCommandProcessor ) <EOL> tftp_reader_mock . assert_called_with ( "<STR_LIT>" , "<STR_LIT:filename>" ) <EOL> vlan1000 = config . get_vlan ( <NUM_LIT:1000> ) <EOL> assert_that ( vlan1000 . name , equal_to ( "<STR_LIT>" ) ) <EOL> vlan2000 = config . get_vlan ( <NUM_LIT> ) <EOL> assert_that ( vlan2000 . name , equal_to ( "<STR_LIT>" ) ) <EOL> @ mock . patch ( "<STR_LIT>" ) <EOL> def test_longer_parsing ( self , tftp_reader_mock ) : <EOL> tftp_reader_mock . return_value = """<STR_LIT>""" <EOL> config = SwitchConfiguration ( "<STR_LIT:127.0.0.1>" , name = "<STR_LIT>" , ports = [ <EOL> Port ( "<STR_LIT>" ) <EOL> ] ) <EOL> parser = SwitchTftpParser ( config ) <EOL> parser . parse ( "<STR_LIT>" , "<STR_LIT:filename>" , ConfigCommandProcessor ) <EOL> vlan1000 = config . get_vlan ( <NUM_LIT:1000> ) <EOL> assert_that ( vlan1000 . name , equal_to ( "<STR_LIT>" ) ) <EOL> eth01 = config . get_port ( "<STR_LIT>" ) <EOL> assert_that ( eth01 . description , equal_to ( "<STR_LIT>" ) ) <EOL> assert_that ( eth01 . mode , equal_to ( "<STR_LIT>" ) ) <EOL> assert_that ( eth01 . access_vlan , equal_to ( <NUM_LIT:1000> ) ) </s>
