From 7325430bc95dd8ff8321da8420e614bfb62a10cf Mon Sep 17 00:00:00 2001 From: Sunny Date: Thu, 23 Jun 2022 15:31:46 +0530 Subject: [PATCH] libgit2/managed/http: test for incomplete creds Add test for createClientRequest() where the credentials are incomplete. Signed-off-by: Sunny --- pkg/git/libgit2/managed/http_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/git/libgit2/managed/http_test.go b/pkg/git/libgit2/managed/http_test.go index be47a690d..3907e443e 100644 --- a/pkg/git/libgit2/managed/http_test.go +++ b/pkg/git/libgit2/managed/http_test.go @@ -105,6 +105,16 @@ func TestHttpAction_CreateClientRequest(t *testing.T) { }, wantedErr: nil, }, + { + name: "incomplete credentials, no basic auth", + action: git2go.SmartServiceActionReceivepackLs, + transport: &http.Transport{}, + authOpts: git.AuthOptions{Username: "user"}, + assertFunc: func(g *WithT, req *http.Request, client *http.Client) { + _, _, ok := req.BasicAuth() + g.Expect(ok).To(BeFalse()) + }, + }, { name: "credentials are correctly configured", action: git2go.SmartServiceActionUploadpack,