def test_download_file_invalid_url(tmpdir):
    """ download should fail when the url is invalid"""
    output = os.path.join(tmpdir.path, 'file')
    with mocked_urllib2({'http://foo.bar/baz': 'abcd'}):
        assert not checkout.download_file('http://foo.bar/qux', output)
def test_download_file(tmpdir):
    """ download a file to disk, assert that location exists on disk"""
    output = os.path.join(tmpdir.path, 'file')
    with mocked_urllib2({'http://foo.bar/baz': 'abcd'}):
        checkout.download_file('http://foo.bar/baz', output)
        eq_(open(output).read(), 'abcd')