(t *testing.T)
| 378 | } |
| 379 | |
| 380 | func 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 | }, |
nothing calls this directly
no test coverage detected