| 445 | } |
| 446 | |
| 447 | func TestSCPCommandUseInsecureCipher(t *testing.T) { |
| 448 | ssh := &MakeConfig{ |
| 449 | Server: "localhost", |
| 450 | User: "drone-scp", |
| 451 | Port: "22", |
| 452 | KeyPath: "./tests/.ssh/id_rsa", |
| 453 | UseInsecureCipher: true, |
| 454 | } |
| 455 | |
| 456 | err := ssh.Scp("./tests/a.txt", "a.txt") |
| 457 | assert.NoError(t, err) |
| 458 | |
| 459 | u, err := user.Lookup("drone-scp") |
| 460 | if err != nil { |
| 461 | t.Fatalf("Lookup: %v", err) |
| 462 | } |
| 463 | |
| 464 | // check file exist |
| 465 | if _, err := os.Stat(path.Join(u.HomeDir, "a.txt")); os.IsNotExist(err) { |
| 466 | t.Fatalf("SCP-error: %v", err) |
| 467 | } |
| 468 | } |
| 469 | |
| 470 | // TestRootAccount test root account |
| 471 | func TestRootAccount(t *testing.T) { |