@@ -7,6 +7,7 @@ use assert_cmd::prelude::*;
7
7
use assert_fs:: prelude:: * ;
8
8
use base64:: { prelude:: BASE64_STANDARD as base64, Engine } ;
9
9
use indoc:: indoc;
10
+ use itertools:: Itertools ;
10
11
use url:: Url ;
11
12
12
13
use common:: { uv_snapshot, TestContext , EXCLUDE_NEWER , INSTA_FILTERS } ;
@@ -16,12 +17,19 @@ use crate::common::get_bin;
16
17
mod common;
17
18
18
19
// This is a fine-grained token that only has read-only access to the `uv-private-pypackage` repository
19
- const READ_ONLY_GITHUB_TOKEN : & str = "MTFCR0laQTdRMEg1MnNYbEJ1Mlg5TF90VU1keWNCYzFvb2psRm9UbEVVYTJEbW54VkhPUXJqaGhRT1UwQVdZV2p0T0wyWlBJM0UzdlFvUmE3eA==" ;
20
-
21
- fn decode_token ( content : & str ) -> String {
22
- let decoded = base64. decode ( content) . unwrap ( ) ;
23
- let mut token = std:: str:: from_utf8 ( decoded. as_slice ( ) ) . unwrap ( ) . to_string ( ) ;
24
- token. insert_str ( 0 , "gitub_pat_" ) ;
20
+ const READ_ONLY_GITHUB_TOKEN : & [ & str ] = & [
21
+ "Z2l0aHViX3BhdA==" ,
22
+ "MTFCR0laQTdRMGdXeGsweHV6ekR2Mg==" ,
23
+ "NVZMaExzZmtFMHZ1ZEVNd0pPZXZkV040WUdTcmk2WXREeFB4TFlybGlwRTZONEpHV01FMnFZQWJVUm4=" ,
24
+ ] ;
25
+
26
+ /// Decode a
27
+ fn decode_token ( content : & [ & str ] ) -> String {
28
+ let token = content
29
+ . iter ( )
30
+ . map ( |part| base64. decode ( part) . unwrap ( ) )
31
+ . map ( |decoded| std:: str:: from_utf8 ( decoded. as_slice ( ) ) . unwrap ( ) . to_string ( ) )
32
+ . join ( "_" ) ;
25
33
token
26
34
}
27
35
@@ -763,7 +771,7 @@ fn install_git_private_https_pat() {
763
771
Resolved 1 package in [TIME]
764
772
Downloaded 1 package in [TIME]
765
773
Installed 1 package in [TIME]
766
- + uv-private-pypackage==0.1.0 (from git+https://: ***@github.com/astral-test/uv-private-pypackage@6c09ce9ae81f50670a60abd7d95f30dd416d00ac)
774
+ + uv-private-pypackage==0.1.0 (from git+https://***@github.com/astral-test/uv-private-pypackage@6c09ce9ae81f50670a60abd7d95f30dd416d00ac)
767
775
"### ) ;
768
776
769
777
context. assert_installed ( "uv_private_pypackage" , "0.1.0" ) ;
@@ -784,18 +792,15 @@ fn install_git_private_https_pat_and_username() {
784
792
uv_snapshot ! ( filters, command( & context)
785
793
. arg( format!( "uv-private-pypackage @ git+https://{user}:{token}@github.com/astral-test/uv-private-pypackage" ) )
786
794
, @r###"
787
- success: false
788
- exit_code: 2
795
+ success: true
796
+ exit_code: 0
789
797
----- stdout -----
790
798
791
799
----- stderr -----
792
- error: Failed to download and build: uv-private-pypackage @ git+https://astral-test-bot:***@github.com/astral-test/uv-private-pypackage
793
- Caused by: Git operation failed
794
- Caused by: failed to clone into: [PATH]
795
- Caused by: failed to authenticate when downloading repository
796
-
797
- * attempted to find username/password via `credential.helper`, but maybe the found credentials were incorrect
798
- Caused by: no authentication methods succeeded
800
+ Resolved 1 package in [TIME]
801
+ Downloaded 1 package in [TIME]
802
+ Installed 1 package in [TIME]
803
+ + uv-private-pypackage==0.1.0 (from git+https://astral-test-bot:***@github.com/astral-test/uv-private-pypackage@6c09ce9ae81f50670a60abd7d95f30dd416d00ac)
799
804
"### ) ;
800
805
801
806
context. assert_installed ( "uv_private_pypackage" , "0.1.0" ) ;
0 commit comments