Skip to content

Commit e12f98a

Browse files
committed
Add test case for trailing /
1 parent 03616eb commit e12f98a

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

crates/uv/tests/it/lock.rs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8358,6 +8358,53 @@ fn lock_multiple_indexes_same_realm_different_credentials() -> Result<()> {
83588358
Ok(())
83598359
}
83608360

8361+
// Same as [`lock_multiple_indexes_same_realm_different_credentials`], but with trailing slashes
8362+
// on the index URL
8363+
#[test]
8364+
fn lock_multiple_indexes_same_realm_different_credentials_trailing_slash() -> Result<()> {
8365+
let context = TestContext::new("3.12");
8366+
8367+
let pyproject_toml = context.temp_dir.child("pyproject.toml");
8368+
pyproject_toml.write_str(
8369+
r#"
8370+
[project]
8371+
name = "foo"
8372+
version = "0.1.0"
8373+
requires-python = ">=3.12"
8374+
dependencies = ["iniconfig", "anyio"]
8375+
8376+
[tool.uv.sources]
8377+
iniconfig = { index = "internal-proxy-heron" }
8378+
anyio = { index = "internal-proxy-eagle" }
8379+
8380+
[[tool.uv.index]]
8381+
name = "internal-proxy-heron"
8382+
url = "https://pypi-proxy.fly.dev/basic-auth-heron/simple/"
8383+
8384+
[[tool.uv.index]]
8385+
name = "internal-proxy-eagle"
8386+
url = "https://pypi-proxy.fly.dev/basic-auth-eagle/simple/"
8387+
"#,
8388+
)?;
8389+
8390+
// Provide credentials via environment variables.
8391+
uv_snapshot!(context.filters(), context.lock()
8392+
.env(EnvVars::index_username("INTERNAL_PROXY_HERON"), "public")
8393+
.env(EnvVars::index_password("INTERNAL_PROXY_HERON"), "heron")
8394+
.env(EnvVars::index_username("INTERNAL_PROXY_EAGLE"), "public")
8395+
.env(EnvVars::index_password("INTERNAL_PROXY_EAGLE"), "eagle"), @r###"
8396+
success: false
8397+
exit_code: 2
8398+
----- stdout -----
8399+
8400+
----- stderr -----
8401+
error: Failed to fetch: `https://pypi-proxy.fly.dev/basic-auth-heron/files/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl.metadata`
8402+
Caused by: HTTP status client error (401 Unauthorized) for url (https://pypi-proxy.fly.dev/basic-auth-heron/files/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl.metadata)
8403+
"###);
8404+
8405+
Ok(())
8406+
}
8407+
83618408
/// Resolve against an index that uses relative links.
83628409
#[test]
83638410
fn lock_relative_index() -> Result<()> {

0 commit comments

Comments
 (0)