Beispiel #1
0
def downloader_can_download_files_over_http():
    downloader = Downloader(NoCachingStrategy())
    
    with create_temporary_dir() as server_root:
        files.write_file(os.path.join(server_root, "hello"), "Hello there!")
        with httpserver.start_static_http_server(server_root) as http_server:
            with create_temporary_dir() as download_dir:
                download_path = os.path.join(download_dir, "file")
                url = http_server.static_url("hello")
                downloader.download(url, download_path)
                assert_equal("Hello there!", files.read_file(download_path))
Beispiel #2
0
 def _generate_index(self):
     index_path = os.path.join(self._http_server.root, "packages.html")
     write_file(index_path, _html_for_index(self._sources))
Beispiel #3
0
def _write_script(path, contents):
    write_file(path, contents)
    _make_executable(path)