Skip to content

Commit e5cc4d7

Browse files
authored
Merge pull request #22681 from JuliaLang/jn/libgit2-test-upgrade
libgit2 test: use a valid user/pass parameter to test EAUTH instead of OS:ERROR
2 parents c67c523 + 8c19548 commit e5cc4d7

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

test/libgit2-online.jl

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,32 @@ mktempdir() do dir
2222
try
2323
repo_path = joinpath(dir, "Example2")
2424
# credentials are required because github tries to authenticate on unknown repo
25-
cred = LibGit2.UserPasswordCredentials("","") # empty credentials cause authentication error
25+
cred = LibGit2.UserPasswordCredentials("JeffBezanson", "hunter2") # make sure Jeff is using a good password :)
2626
LibGit2.clone(repo_url*randstring(10), repo_path, payload=Nullable(cred))
2727
error("unexpected")
2828
catch ex
2929
@test isa(ex, LibGit2.Error.GitError)
3030
@test ex.code == LibGit2.Error.EAUTH
3131
end
3232
end
33+
34+
@testset "with empty credentials" begin
35+
try
36+
repo_path = joinpath(dir, "Example3")
37+
# credentials are required because github tries to authenticate on unknown repo
38+
cred = LibGit2.UserPasswordCredentials("","") # empty credentials cause authentication error
39+
LibGit2.clone(repo_url*randstring(10), repo_path, payload=Nullable(cred))
40+
error("unexpected")
41+
catch ex
42+
@test isa(ex, LibGit2.Error.GitError)
43+
if is_windows() && LibGit2.version() >= v"0.26.0"
44+
# see #22681 and https://github.com/libgit2/libgit2/pull/4055
45+
@test_broken ex.code == LibGit2.Error.EAUTH
46+
@test ex.code == LibGit2.Error.ERROR
47+
else
48+
@test ex.code == LibGit2.Error.EAUTH
49+
end
50+
end
51+
end
3352
end
3453
end

0 commit comments

Comments
 (0)