(t *testing.T)
| 183 | } |
| 184 | |
| 185 | func TestAuthMethodFallback(t *testing.T) { |
| 186 | var passwordCalled bool |
| 187 | config := &ClientConfig{ |
| 188 | User: "testuser", |
| 189 | Auth: []AuthMethod{ |
| 190 | PublicKeys(testSigners["rsa"]), |
| 191 | PasswordCallback( |
| 192 | func() (string, error) { |
| 193 | passwordCalled = true |
| 194 | return "WRONG", nil |
| 195 | }), |
| 196 | }, |
| 197 | HostKeyCallback: InsecureIgnoreHostKey(), |
| 198 | } |
| 199 | |
| 200 | if err := tryAuth(t, config); err != nil { |
| 201 | t.Fatalf("unable to dial remote side: %s", err) |
| 202 | } |
| 203 | |
| 204 | if passwordCalled { |
| 205 | t.Errorf("password auth tried before public-key auth.") |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | func TestAuthMethodWrongPassword(t *testing.T) { |
| 210 | config := &ClientConfig{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…