forked from astral-sh/uv
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test case for URL with basic authentication (astral-sh#2463)
Closes astral-sh#2447
- Loading branch information
Showing
1 changed file
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2762,3 +2762,84 @@ requires-python = "<=3.8" | |
|
||
Ok(()) | ||
} | ||
|
||
/// Install a package from an index that requires authentication | ||
#[test] | ||
fn install_package_basic_auth_from_url() { | ||
let context = TestContext::new("3.12"); | ||
|
||
uv_snapshot!(command(&context) | ||
.arg("anyio") | ||
.arg("--index-url") | ||
.arg("https://public:[email protected]/basic-auth/simple") | ||
.arg("--strict"), @r###" | ||
success: true | ||
exit_code: 0 | ||
----- stdout ----- | ||
----- stderr ----- | ||
Resolved 3 packages in [TIME] | ||
Downloaded 3 packages in [TIME] | ||
Installed 3 packages in [TIME] | ||
+ anyio==4.0.0 | ||
+ idna==3.4 | ||
+ sniffio==1.3.0 | ||
"### | ||
); | ||
|
||
context.assert_command("import anyio").success(); | ||
} | ||
|
||
/// Install a package from an index that provides relative links | ||
#[test] | ||
fn install_index_with_relative_links() { | ||
let context = TestContext::new("3.12"); | ||
|
||
uv_snapshot!(command(&context) | ||
.arg("anyio") | ||
.arg("--index-url") | ||
.arg("https://pypi-proxy.fly.dev/relative/simple") | ||
.arg("--strict"), @r###" | ||
success: true | ||
exit_code: 0 | ||
----- stdout ----- | ||
----- stderr ----- | ||
Resolved 3 packages in [TIME] | ||
Downloaded 3 packages in [TIME] | ||
Installed 3 packages in [TIME] | ||
+ anyio==4.0.0 | ||
+ idna==3.4 | ||
+ sniffio==1.3.0 | ||
"### | ||
); | ||
|
||
context.assert_command("import anyio").success(); | ||
} | ||
|
||
/// Install a package from an index that provides relative links and requires authentication | ||
#[test] | ||
fn install_index_with_relative_links_authenticated() { | ||
let context = TestContext::new("3.12"); | ||
|
||
uv_snapshot!(command(&context) | ||
.arg("anyio") | ||
.arg("--index-url") | ||
.arg("https://public:[email protected]/basic-auth/relative/simple") | ||
.arg("--strict"), @r###" | ||
success: true | ||
exit_code: 0 | ||
----- stdout ----- | ||
----- stderr ----- | ||
Resolved 3 packages in [TIME] | ||
Downloaded 3 packages in [TIME] | ||
Installed 3 packages in [TIME] | ||
+ anyio==4.0.0 | ||
+ idna==3.4 | ||
+ sniffio==1.3.0 | ||
"### | ||
); | ||
|
||
context.assert_command("import anyio").success(); | ||
} |