def METHOD_NAME(expected_url, port):
    old_native_download_file_init = NativeDownloadFile.__init__
    def new_init(self, **kwargs):
        assert kwargs["url"] == expected_url
        kwargs["url"] = f"http://localhost:{port}/file.txt"
        return old_native_download_file_init(self, **kwargs)
    monkeypatch.setattr(NativeDownloadFile, "__init__", new_init)