def test_read_urlopen_read_returns_bytes(self):
     try:
         html = bytes('<html><h1>virtualenv 13.1.0</h1></html>', 'utf-8')
     except TypeError:
         html = bytes('<html><h1>virtualenv 13.1.0</h1></html>')
     self.mock_urlopen.return_value.read.return_value = html
     r = bootstrap_vi.get_latest_virtualenv_version()
     self.assertEqual('13.1.0', r)
 def test_gets_correct_version(self):
     self.mock_urlopen.return_value.read.return_value = \
         '<html><h1>virtualenv 13.1.0</h1></html>'
     r = bootstrap_vi.get_latest_virtualenv_version()
     self.assertEqual('13.1.0', r)
     self.mock_urlopen.assert_called_once_with(
         bootstrap_vi.PYPI_VI_URL
     )
     self.mock_urlopen.return_value.read.assert_called_once_with()
 def test_creates_virtualenv_with_args_run_from_pipe(self):
     self.mock_sys.argv = ['-', 'vpath', '--prompt', 'findpromptfind']
     self.latest_ver = bootstrap_vi.get_latest_virtualenv_version()
     bootstrap_vi.main()
     with open('vpath/bin/activate') as fh:
         self.assertIn('findpromptfind', fh.read())