def test_unpack_http_url_with_urllib_response_without_content_type(data):
 _real_session = PipSession()
 def _fake_session_get(*args, **kwargs):
  resp = _real_session.get(*args, **kwargs)
  del resp.headers['Content-Type']
  return resp
 session = Mock()
 session.get = _fake_session_get
 uri = path_to_url(data.packages.join('simple-1.0.tar.gz'))
 link = Link(uri)
 temp_dir = mkdtemp()
 try:
  unpack_http_url(link, temp_dir, download_dir=None, session=session)
  assert (set(os.listdir(temp_dir)) == set(['PKG-INFO', 'setup.cfg', 'setup.py', 'simple', 'simple.egg-info']))
 finally:
  rmtree(temp_dir)

def test_unpack_http_url_with_urllib_response_without_content_type ( data ) : _real_session = PipSession ( ) def _fake_session_get ( * args , ** kwargs ) : resp = _real_session . get ( * args , ** kwargs ) del resp . headers [ 'Content-Type' ] return resp session = Mock ( ) session . get = _fake_session_get uri = path_to_url ( data . packages . join ( 'simple-1.0.tar.gz' ) ) link = Link ( uri ) temp_dir = mkdtemp ( ) try : unpack_http_url ( link , temp_dir , download_dir = None , session = session ) assert ( set ( os . listdir ( temp_dir ) ) == set ( [ 'PKG-INFO' , 'setup.cfg' , 'setup.py' , 'simple' , 'simple.egg-info' ] ) ) finally : rmtree ( temp_dir )
it should download and unpack files even if no content-type header exists .