MCPcopy
hub / github.com/git-lfs/git-lfs / TestGetCreds

Function TestGetCreds

lfsapi/auth_test.go:380–675  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

378}
379
380func TestGetCreds(t *testing.T) {
381 tests := map[string]getCredsTest{
382 "no access": getCredsTest{
383 Remote: "origin",
384 Method: "GET",
385 Href: "https://git-server.com/repo/lfs/locks",
386 Endpoint: "https://git-server.com/repo/lfs",
387 Config: map[string]string{
388 "lfs.url": "https://git-server.com/repo/lfs",
389 },
390 Expected: getCredsExpected{
391 Access: creds.NoneAccess,
392 },
393 },
394 "basic access": getCredsTest{
395 Remote: "origin",
396 Method: "GET",
397 Href: "https://git-server.com/repo/lfs/locks",
398 Endpoint: "https://git-server.com/repo/lfs",
399 Config: map[string]string{
400 "lfs.url": "https://git-server.com/repo/lfs",
401 "lfs.https://git-server.com/repo/lfs.access": "basic",
402 },
403 Expected: getCredsExpected{
404 Access: creds.BasicAccess,
405 Authorization: basicAuth("git-server.com", "monkey"),
406 CredsURL: "https://git-server.com/repo/lfs",
407 Creds: map[string][]string{
408 "protocol": []string{"https"},
409 "host": []string{"git-server.com"},
410 "username": []string{"git-server.com"},
411 "password": []string{"monkey"},
412 },
413 },
414 },
415 "basic access with usehttppath": getCredsTest{
416 Remote: "origin",
417 Method: "GET",
418 Href: "https://git-server.com/repo/lfs/locks",
419 Endpoint: "https://git-server.com/repo/lfs",
420 Config: map[string]string{
421 "lfs.url": "https://git-server.com/repo/lfs",
422 "lfs.https://git-server.com/repo/lfs.access": "basic",
423 "credential.usehttppath": "true",
424 },
425 Expected: getCredsExpected{
426 Access: creds.BasicAccess,
427 Authorization: basicAuth("git-server.com", "monkey"),
428 CredsURL: "https://git-server.com/repo/lfs",
429 Creds: map[string][]string{
430 "protocol": []string{"https"},
431 "host": []string{"git-server.com"},
432 "username": []string{"git-server.com"},
433 "password": []string{"monkey"},
434 "path": []string{"repo/lfs"},
435 },
436 },
437 },

Callers

nothing calls this directly

Calls 14

getCredsMethod · 0.95
NewContextFunction · 0.92
NewReadOnlyConfigFunction · 0.92
basicAuthFunction · 0.85
NewEndpointFinderFunction · 0.85
LogMethod · 0.80
NewClientFunction · 0.70
ErrorfMethod · 0.65
SetMethod · 0.65
AccessForMethod · 0.65
GetMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected