(t *testing.T)
| 738 | } |
| 739 | |
| 740 | func TestLoginRefreshableRejectsInvalidCredential(t *testing.T) { |
| 741 | valid := gh.Credential{Token: "access", RefreshToken: "refresh"} |
| 742 | tests := []struct { |
| 743 | name string |
| 744 | hostname string |
| 745 | username string |
| 746 | credential gh.Credential |
| 747 | }{ |
| 748 | {name: "empty hostname", hostname: "", username: "test-user", credential: valid}, |
| 749 | {name: "empty username", hostname: "github.com", username: "", credential: valid}, |
| 750 | {name: "missing access token", hostname: "github.com", username: "test-user", credential: gh.Credential{RefreshToken: "refresh"}}, |
| 751 | {name: "missing refresh token", hostname: "github.com", username: "test-user", credential: gh.Credential{Token: "access"}}, |
| 752 | } |
| 753 | for _, tt := range tests { |
| 754 | t.Run(tt.name, func(t *testing.T) { |
| 755 | authCfg := newTestAuthConfig(t) |
| 756 | |
| 757 | _, err := authCfg.LoginRefreshable(tt.hostname, tt.username, tt.credential, "ssh", true) |
| 758 | |
| 759 | require.Error(t, err) |
| 760 | }) |
| 761 | } |
| 762 | } |
| 763 | |
| 764 | func TestLoginRefreshablePurgesNonExpiringLogin(t *testing.T) { |
| 765 | authCfg := newTestAuthConfig(t) |
nothing calls this directly
no test coverage detected