Skip to content

Commit ac1fa25

Browse files
committed
Add test case with username
1 parent b21f3cc commit ac1fa25

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

crates/uv/tests/pip_install.rs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ fn install_git_public_https() {
732732

733733
/// Install a package from a private GitHub repository using a PAT
734734
#[test]
735-
fn install_git_private_https_pat() {
735+
fn install_git_private_https_pat_no_username() {
736736
let context = TestContext::new("3.8");
737737

738738
// This is a fine-grained token that only has read-only access to the `uv-private-pypackage` repository
@@ -755,6 +755,35 @@ fn install_git_private_https_pat() {
755755
context.assert_installed("uv_private_pypackage", "0.1.0");
756756
}
757757

758+
/// Install a package from a private GitHub repository using a PAT
759+
#[test]
760+
fn install_git_private_https_pat() {
761+
let context = TestContext::new("3.8");
762+
763+
// This is a fine-grained token that only has read-only access to the `uv-private-pypackage` repository
764+
let token = "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";
765+
let user = "astral-test-bot";
766+
767+
uv_snapshot!(command(&context)
768+
.arg(format!("uv-private-pypackage @ git+https://{user}:{token}@github.com/astral-test/uv-private-pypackage"))
769+
, @r###"
770+
success: false
771+
exit_code: 2
772+
----- stdout -----
773+
774+
----- stderr -----
775+
error: Failed to download and build: uv-private-pypackage @ git+https://astral-test-bot:github_pat_[SIZE]GIZA7Q0qxQCNd[SIZE]VVCf_8ZeenAddxUYnR82xy7geDJo5DsazrjdVjfh3TH[TIME][email protected]/astral-test/uv-private-pypackage
776+
Caused by: Git operation failed
777+
Caused by: failed to clone into: /private/var/folders/bc/qlsk3t6x7c9fhhbvvcg68k9c0000gp/T/.tmpijslxX/git-v0/db/732d1383ce6d692d
778+
Caused by: failed to authenticate when downloading repository
779+
780+
* attempted to find username/password via git's `credential.helper` support, but failed
781+
Caused by: failed to acquire username/password from local configuration
782+
"###);
783+
784+
context.assert_installed("uv_private_pypackage", "0.1.0");
785+
}
786+
758787
/// Install a package without using pre-built wheels.
759788
#[test]
760789
fn reinstall_no_binary() {

0 commit comments

Comments
 (0)