<s> import unittest <EOL> import mock <EOL> import urllib2 <EOL> import vim_bootstrap_updater as sut <EOL> class VimBootstrapUpdaterTests ( unittest . TestCase ) : <EOL> @ mock . patch ( '<STR_LIT>' ) <EOL> @ mock . patch ( '<STR_LIT>' , return_value = '<STR_LIT>' ) <EOL> def test_generate_vimrc_200 ( self , mock_VIMRC_PATH , mock_urlopen ) : <EOL> mock_response = mock . MagicMock ( ) <EOL> mock_response . code = <NUM_LIT:200> <EOL> mock_response . read . return_value = '<STR_LIT>' <EOL> mock_urlopen . return_value = mock_response <EOL> result = sut . _generate_vimrc ( '<STR_LIT>' , [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . assertEqual ( mock_urlopen . call_args , mock . call ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ) ) <EOL> self . assertEqual ( '<STR_LIT>' , result ) <EOL> @ mock . patch ( '<STR_LIT>' ) <EOL> @ mock . patch ( '<STR_LIT>' , return_value = '<STR_LIT>' ) <EOL> def test_generate_vimrc_NOT_200 ( self , mock_VIMRC_PATH , mock_urlopen ) : <EOL> mock_urlopen . side_effect = urllib2 . HTTPError ( <EOL> url = "<STR_LIT>" , <EOL> code = <NUM_LIT> , msg = "<STR_LIT>" , hdrs = None , fp = None ) <EOL> with self . assertRaises ( urllib2 . HTTPError ) : <EOL> sut . _generate_vimrc ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> @ mock . patch ( '<STR_LIT>' , return_value = '<STR_LIT>' ) <EOL> def test_update ( self , mock_generate_vimrc ) : <EOL> result = sut . update ( '<STR_LIT>' , '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , result ) <EOL> with open ( '<STR_LIT>' , '<STR_LIT:r>' ) as fh : <EOL> content = fh . read ( ) <EOL> self . assertEqual ( '<STR_LIT>' , content ) </s>
