(t *testing.T)
| 577 | } |
| 578 | |
| 579 | func TestLoginRefreshableRejectsInvalidCredential(t *testing.T) { |
| 580 | valid := gh.Credential{Token: "access", RefreshToken: "refresh"} |
| 581 | tests := []struct { |
| 582 | name string |
| 583 | hostname string |
| 584 | username string |
| 585 | credential gh.Credential |
| 586 | }{ |
| 587 | {name: "empty hostname", hostname: "", username: "test-user", credential: valid}, |
| 588 | {name: "empty username", hostname: "github.com", username: "", credential: valid}, |
| 589 | {name: "missing access token", hostname: "github.com", username: "test-user", credential: gh.Credential{RefreshToken: "refresh"}}, |
| 590 | {name: "missing refresh token", hostname: "github.com", username: "test-user", credential: gh.Credential{Token: "access"}}, |
| 591 | } |
| 592 | for _, tt := range tests { |
| 593 | t.Run(tt.name, func(t *testing.T) { |
| 594 | authCfg := newTestAuthConfig(t) |
| 595 | |
| 596 | _, err := authCfg.LoginRefreshable(tt.hostname, tt.username, tt.credential, "ssh", true) |
| 597 | |
| 598 | require.Error(t, err) |
| 599 | }) |
| 600 | } |
| 601 | } |
| 602 | |
| 603 | func TestLoginRefreshablePurgesNonExpiringLogin(t *testing.T) { |
| 604 | authCfg := newTestAuthConfig(t) |
nothing calls this directly
no test coverage detected