diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-06-26 07:56:10 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-06-26 07:56:10 +0100 |
| commit | 6b06e874119ceca1a9dac1b94dcfe6e06aacd7b9 (patch) | |
| tree | 54a7a7bdeda29fd792f1335c556d6639cd693c64 | |
| parent | b63bfc9a34657c5767c507deb7c059e24dd22779 (diff) | |
refactor: remove fresh test config
as config is now stored using git config and cache is conditionally
stored in local ./git folder under test conditions
| -rw-r--r-- | test_utils/src/lib.rs | 53 | ||||
| -rw-r--r-- | tests/login.rs | 567 |
2 files changed, 259 insertions, 361 deletions
diff --git a/test_utils/src/lib.rs b/test_utils/src/lib.rs index ade60fc..64e3fff 100644 --- a/test_utils/src/lib.rs +++ b/test_utils/src/lib.rs | |||
| @@ -2,7 +2,6 @@ use std::{ffi::OsStr, path::PathBuf, str::FromStr}; | |||
| 2 | 2 | ||
| 3 | use anyhow::{bail, ensure, Context, Result}; | 3 | use anyhow::{bail, ensure, Context, Result}; |
| 4 | use dialoguer::theme::{ColorfulTheme, Theme}; | 4 | use dialoguer::theme::{ColorfulTheme, Theme}; |
| 5 | use directories::ProjectDirs; | ||
| 6 | use nostr::{self, nips::nip65::RelayMetadata, Kind, Tag}; | 5 | use nostr::{self, nips::nip65::RelayMetadata, Kind, Tag}; |
| 7 | use nostr_sdk::{serde_json, NostrSigner, TagStandard}; | 6 | use nostr_sdk::{serde_json, NostrSigner, TagStandard}; |
| 8 | use once_cell::sync::Lazy; | 7 | use once_cell::sync::Lazy; |
| @@ -934,55 +933,3 @@ where | |||
| 934 | }, | 933 | }, |
| 935 | ) | 934 | ) |
| 936 | } | 935 | } |
| 937 | |||
| 938 | /// backup and remove application config and data | ||
| 939 | pub fn before() -> Result<()> { | ||
| 940 | backup_existing_config() | ||
| 941 | } | ||
| 942 | |||
| 943 | /// restore backuped application config and data | ||
| 944 | pub fn after() -> Result<()> { | ||
| 945 | restore_config_backup() | ||
| 946 | } | ||
| 947 | |||
| 948 | /// run func between before and after scripts which backup, reset and restore | ||
| 949 | /// application config | ||
| 950 | /// | ||
| 951 | /// TODO: fix issue: if func panics, after() is not run. | ||
| 952 | pub fn with_fresh_config<F>(func: F) -> Result<()> | ||
| 953 | where | ||
| 954 | F: Fn() -> Result<()>, | ||
| 955 | { | ||
| 956 | before()?; | ||
| 957 | func()?; | ||
| 958 | after() | ||
| 959 | } | ||
| 960 | |||
| 961 | fn backup_existing_config() -> Result<()> { | ||
| 962 | let config_path = get_dirs().config_dir().join("cache.sqlite"); | ||
| 963 | let backup_config_path = get_dirs().config_dir().join("cache-backup.sqlite"); | ||
| 964 | if !backup_config_path.exists() { | ||
| 965 | std::fs::rename(&config_path, backup_config_path)?; | ||
| 966 | } | ||
| 967 | if config_path.exists() { | ||
| 968 | std::fs::remove_file(&config_path)?; | ||
| 969 | } | ||
| 970 | Ok(()) | ||
| 971 | } | ||
| 972 | |||
| 973 | fn restore_config_backup() -> Result<()> { | ||
| 974 | let config_path = get_dirs().config_dir().join("cache.sqlite"); | ||
| 975 | let backup_config_path = get_dirs().config_dir().join("cache-backup.sqlite"); | ||
| 976 | if config_path.exists() { | ||
| 977 | std::fs::remove_file(&config_path)?; | ||
| 978 | } | ||
| 979 | if backup_config_path.exists() { | ||
| 980 | std::fs::rename(backup_config_path, config_path)?; | ||
| 981 | } | ||
| 982 | Ok(()) | ||
| 983 | } | ||
| 984 | |||
| 985 | fn get_dirs() -> ProjectDirs { | ||
| 986 | ProjectDirs::from("", "CodeCollaboration", "ngit") | ||
| 987 | .expect("rust directories crate should return ProjectDirs") | ||
| 988 | } | ||
diff --git a/tests/login.rs b/tests/login.rs index aaadf00..03fc2a9 100644 --- a/tests/login.rs +++ b/tests/login.rs | |||
| @@ -57,26 +57,24 @@ mod with_relays { | |||
| 57 | ); | 57 | ); |
| 58 | 58 | ||
| 59 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 59 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 60 | with_fresh_config(|| { | 60 | let mut p = CliTester::new(["login"]); |
| 61 | let mut p = CliTester::new(["login"]); | ||
| 62 | 61 | ||
| 63 | p.expect_input(EXPECTED_NSEC_PROMPT)? | 62 | p.expect_input(EXPECTED_NSEC_PROMPT)? |
| 64 | .succeeds_with(TEST_KEY_1_NSEC)?; | 63 | .succeeds_with(TEST_KEY_1_NSEC)?; |
| 65 | 64 | ||
| 66 | p.expect_confirm(EXPECTED_LOCAL_REPOSITORY_PROMPT, Some(false))? | 65 | p.expect_confirm(EXPECTED_LOCAL_REPOSITORY_PROMPT, Some(false))? |
| 67 | .succeeds_with(Some(true))?; | 66 | .succeeds_with(Some(true))?; |
| 68 | 67 | ||
| 69 | p.expect_confirm(EXPECTED_REQUIRE_PASSWORD_PROMPT, Some(false))? | 68 | p.expect_confirm(EXPECTED_REQUIRE_PASSWORD_PROMPT, Some(false))? |
| 70 | .succeeds_with(Some(false))?; | 69 | .succeeds_with(Some(false))?; |
| 71 | 70 | ||
| 72 | p.expect("searching for profile and relay updates...\r\n")?; | 71 | p.expect("searching for profile and relay updates...\r\n")?; |
| 73 | 72 | ||
| 74 | p.expect_end_with("logged in as fred\r\n")?; | 73 | p.expect_end_with("logged in as fred\r\n")?; |
| 75 | for p in [51, 52] { | 74 | for p in [51, 52] { |
| 76 | shutdown_relay(8000 + p)?; | 75 | shutdown_relay(8000 + p)?; |
| 77 | } | 76 | } |
| 78 | Ok(()) | 77 | Ok(()) |
| 79 | }) | ||
| 80 | }); | 78 | }); |
| 81 | 79 | ||
| 82 | // launch relay | 80 | // launch relay |
| @@ -96,30 +94,28 @@ mod with_relays { | |||
| 96 | ); | 94 | ); |
| 97 | 95 | ||
| 98 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 96 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 99 | with_fresh_config(|| { | 97 | let mut p = CliTester::new(["login"]); |
| 100 | let mut p = CliTester::new(["login"]); | ||
| 101 | 98 | ||
| 102 | p.expect_input(EXPECTED_NSEC_PROMPT)? | 99 | p.expect_input(EXPECTED_NSEC_PROMPT)? |
| 103 | .succeeds_with(TEST_KEY_1_NSEC)?; | 100 | .succeeds_with(TEST_KEY_1_NSEC)?; |
| 104 | 101 | ||
| 105 | p.expect_confirm(EXPECTED_LOCAL_REPOSITORY_PROMPT, Some(false))? | 102 | p.expect_confirm(EXPECTED_LOCAL_REPOSITORY_PROMPT, Some(false))? |
| 106 | .succeeds_with(Some(true))?; | 103 | .succeeds_with(Some(true))?; |
| 107 | 104 | ||
| 108 | p.expect_confirm(EXPECTED_REQUIRE_PASSWORD_PROMPT, Some(false))? | 105 | p.expect_confirm(EXPECTED_REQUIRE_PASSWORD_PROMPT, Some(false))? |
| 109 | .succeeds_with(Some(false))?; | 106 | .succeeds_with(Some(false))?; |
| 110 | 107 | ||
| 111 | p.expect("searching for profile and relay updates...\r\n")?; | 108 | p.expect("searching for profile and relay updates...\r\n")?; |
| 112 | 109 | ||
| 113 | p.expect("cannot extract account name from account metadata...\r\n")?; | 110 | p.expect("cannot extract account name from account metadata...\r\n")?; |
| 114 | 111 | ||
| 115 | p.expect_end_with( | 112 | p.expect_end_with( |
| 116 | format!("logged in as {}\r\n", TEST_KEY_1_NPUB).as_str(), | 113 | format!("logged in as {}\r\n", TEST_KEY_1_NPUB).as_str(), |
| 117 | )?; | 114 | )?; |
| 118 | for p in [51, 52] { | 115 | for p in [51, 52] { |
| 119 | shutdown_relay(8000 + p)?; | 116 | shutdown_relay(8000 + p)?; |
| 120 | } | 117 | } |
| 121 | Ok(()) | 118 | Ok(()) |
| 122 | }) | ||
| 123 | }); | 119 | }); |
| 124 | 120 | ||
| 125 | // launch relay | 121 | // launch relay |
| @@ -410,17 +406,15 @@ mod with_relays { | |||
| 410 | ); | 406 | ); |
| 411 | 407 | ||
| 412 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 408 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 413 | with_fresh_config(|| { | 409 | let mut p = CliTester::new(["login", "--nsec", TEST_KEY_1_NSEC]); |
| 414 | let mut p = CliTester::new(["login", "--nsec", TEST_KEY_1_NSEC]); | ||
| 415 | 410 | ||
| 416 | p.expect("searching for profile and relay updates...\r\n")?; | 411 | p.expect("searching for profile and relay updates...\r\n")?; |
| 417 | 412 | ||
| 418 | p.expect_end_with("logged in as fred\r\n")?; | 413 | p.expect_end_with("logged in as fred\r\n")?; |
| 419 | for p in [51, 52] { | 414 | for p in [51, 52] { |
| 420 | shutdown_relay(8000 + p)?; | 415 | shutdown_relay(8000 + p)?; |
| 421 | } | 416 | } |
| 422 | Ok(()) | 417 | Ok(()) |
| 423 | }) | ||
| 424 | }); | 418 | }); |
| 425 | 419 | ||
| 426 | // launch relay | 420 | // launch relay |
| @@ -462,27 +456,25 @@ mod with_relays { | |||
| 462 | ); | 456 | ); |
| 463 | 457 | ||
| 464 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 458 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 465 | with_fresh_config(|| { | 459 | CliTester::new([ |
| 466 | CliTester::new([ | 460 | "login", |
| 467 | "login", | 461 | "--offline", |
| 468 | "--offline", | 462 | "--nsec", |
| 469 | "--nsec", | 463 | TEST_KEY_1_NSEC, |
| 470 | TEST_KEY_1_NSEC, | 464 | "--password", |
| 471 | "--password", | 465 | TEST_PASSWORD, |
| 472 | TEST_PASSWORD, | 466 | ]) |
| 473 | ]) | 467 | .expect_end_eventually()?; |
| 474 | .expect_end_eventually()?; | 468 | |
| 475 | 469 | let mut p = CliTester::new(["login", "--password", TEST_PASSWORD]); | |
| 476 | let mut p = CliTester::new(["login", "--password", TEST_PASSWORD]); | 470 | |
| 477 | 471 | p.expect("searching for profile and relay updates...\r\n")?; | |
| 478 | p.expect("searching for profile and relay updates...\r\n")?; | 472 | |
| 479 | 473 | p.expect_end_with("logged in as fred\r\n")?; | |
| 480 | p.expect_end_with("logged in as fred\r\n")?; | 474 | for p in [51, 52] { |
| 481 | for p in [51, 52] { | 475 | shutdown_relay(8000 + p)?; |
| 482 | shutdown_relay(8000 + p)?; | 476 | } |
| 483 | } | 477 | Ok(()) |
| 484 | Ok(()) | ||
| 485 | }) | ||
| 486 | }); | 478 | }); |
| 487 | 479 | ||
| 488 | // launch relay | 480 | // launch relay |
| @@ -524,23 +516,21 @@ mod with_relays { | |||
| 524 | ); | 516 | ); |
| 525 | 517 | ||
| 526 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 518 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 527 | with_fresh_config(|| { | 519 | let mut p = CliTester::new([ |
| 528 | let mut p = CliTester::new([ | 520 | "login", |
| 529 | "login", | 521 | "--nsec", |
| 530 | "--nsec", | 522 | TEST_KEY_1_NSEC, |
| 531 | TEST_KEY_1_NSEC, | 523 | "--password", |
| 532 | "--password", | 524 | TEST_PASSWORD, |
| 533 | TEST_PASSWORD, | 525 | ]); |
| 534 | ]); | 526 | |
| 535 | 527 | p.expect("searching for profile and relay updates...\r\n")?; | |
| 536 | p.expect("searching for profile and relay updates...\r\n")?; | 528 | |
| 537 | 529 | p.expect_end_with("logged in as fred\r\n")?; | |
| 538 | p.expect_end_with("logged in as fred\r\n")?; | 530 | for p in [51, 52] { |
| 539 | for p in [51, 52] { | 531 | shutdown_relay(8000 + p)?; |
| 540 | shutdown_relay(8000 + p)?; | 532 | } |
| 541 | } | 533 | Ok(()) |
| 542 | Ok(()) | ||
| 543 | }) | ||
| 544 | }); | 534 | }); |
| 545 | 535 | ||
| 546 | // launch relay | 536 | // launch relay |
| @@ -571,32 +561,26 @@ mod with_relays { | |||
| 571 | ); | 561 | ); |
| 572 | 562 | ||
| 573 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 563 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 574 | with_fresh_config(|| { | 564 | let mut p = CliTester::new(["login"]); |
| 575 | let mut p = CliTester::new(["login"]); | ||
| 576 | 565 | ||
| 577 | p.expect_input(EXPECTED_NSEC_PROMPT)? | 566 | p.expect_input(EXPECTED_NSEC_PROMPT)? |
| 578 | .succeeds_with(TEST_KEY_1_NSEC)?; | 567 | .succeeds_with(TEST_KEY_1_NSEC)?; |
| 579 | 568 | ||
| 580 | p.expect_confirm(EXPECTED_LOCAL_REPOSITORY_PROMPT, Some(false))? | 569 | p.expect_confirm(EXPECTED_LOCAL_REPOSITORY_PROMPT, Some(false))? |
| 581 | .succeeds_with(Some(true))?; | 570 | .succeeds_with(Some(true))?; |
| 582 | 571 | ||
| 583 | p.expect_confirm(EXPECTED_REQUIRE_PASSWORD_PROMPT, Some(false))? | 572 | p.expect_confirm(EXPECTED_REQUIRE_PASSWORD_PROMPT, Some(false))? |
| 584 | .succeeds_with(Some(false))?; | 573 | .succeeds_with(Some(false))?; |
| 585 | 574 | ||
| 586 | p.expect("searching for profile and relay updates...\r\n")?; | 575 | p.expect("searching for profile and relay updates...\r\n")?; |
| 587 | 576 | ||
| 588 | p.expect( | 577 | p.expect("cannot find your account metadata (name, etc) on relays\r\n")?; |
| 589 | "cannot find your account metadata (name, etc) on relays\r\n", | ||
| 590 | )?; | ||
| 591 | 578 | ||
| 592 | p.expect_end_with( | 579 | p.expect_end_with(format!("logged in as {TEST_KEY_1_NPUB}\r\n").as_str())?; |
| 593 | format!("logged in as {TEST_KEY_1_NPUB}\r\n").as_str(), | 580 | for p in [51, 52] { |
| 594 | )?; | 581 | shutdown_relay(8000 + p)?; |
| 595 | for p in [51, 52] { | 582 | } |
| 596 | shutdown_relay(8000 + p)?; | 583 | Ok(()) |
| 597 | } | ||
| 598 | Ok(()) | ||
| 599 | }) | ||
| 600 | }); | 584 | }); |
| 601 | 585 | ||
| 602 | // launch relay | 586 | // launch relay |
| @@ -637,28 +621,26 @@ mod with_relays { | |||
| 637 | ); | 621 | ); |
| 638 | 622 | ||
| 639 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 623 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 640 | with_fresh_config(|| { | 624 | let mut p = CliTester::new(["login"]); |
| 641 | let mut p = CliTester::new(["login"]); | ||
| 642 | 625 | ||
| 643 | p.expect_input(EXPECTED_NSEC_PROMPT)? | 626 | p.expect_input(EXPECTED_NSEC_PROMPT)? |
| 644 | .succeeds_with(TEST_KEY_1_NSEC)?; | 627 | .succeeds_with(TEST_KEY_1_NSEC)?; |
| 645 | 628 | ||
| 646 | p.expect_confirm(EXPECTED_LOCAL_REPOSITORY_PROMPT, Some(false))? | 629 | p.expect_confirm(EXPECTED_LOCAL_REPOSITORY_PROMPT, Some(false))? |
| 647 | .succeeds_with(Some(true))?; | 630 | .succeeds_with(Some(true))?; |
| 648 | 631 | ||
| 649 | p.expect_confirm(EXPECTED_REQUIRE_PASSWORD_PROMPT, Some(false))? | 632 | p.expect_confirm(EXPECTED_REQUIRE_PASSWORD_PROMPT, Some(false))? |
| 650 | .succeeds_with(Some(false))?; | 633 | .succeeds_with(Some(false))?; |
| 651 | 634 | ||
| 652 | p.expect("searching for profile and relay updates...\r\n")?; | 635 | p.expect("searching for profile and relay updates...\r\n")?; |
| 653 | 636 | ||
| 654 | p.expect("cannot find your relay list. consider using another nostr client to create one to enhance your nostr experience.\r\n")?; | 637 | p.expect("cannot find your relay list. consider using another nostr client to create one to enhance your nostr experience.\r\n")?; |
| 655 | 638 | ||
| 656 | p.expect_end_with("logged in as fred\r\n")?; | 639 | p.expect_end_with("logged in as fred\r\n")?; |
| 657 | for p in [51, 52] { | 640 | for p in [51, 52] { |
| 658 | shutdown_relay(8000 + p)?; | 641 | shutdown_relay(8000 + p)?; |
| 659 | } | 642 | } |
| 660 | Ok(()) | 643 | Ok(()) |
| 661 | }) | ||
| 662 | }); | 644 | }); |
| 663 | 645 | ||
| 664 | // launch relay | 646 | // launch relay |
| @@ -703,29 +685,27 @@ mod with_relays { | |||
| 703 | ); | 685 | ); |
| 704 | 686 | ||
| 705 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 687 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 706 | with_fresh_config(|| { | 688 | let mut p = CliTester::new([ |
| 707 | let mut p = CliTester::new([ | 689 | "login", |
| 708 | "login", | 690 | "--nsec", |
| 709 | "--nsec", | 691 | TEST_KEY_1_NSEC, |
| 710 | TEST_KEY_1_NSEC, | 692 | "--password", |
| 711 | "--password", | 693 | TEST_PASSWORD, |
| 712 | TEST_PASSWORD, | 694 | ]); |
| 713 | ]); | ||
| 714 | 695 | ||
| 715 | p.expect_end_eventually_with("logged in as fred\r\n")?; | 696 | p.expect_end_eventually_with("logged in as fred\r\n")?; |
| 716 | 697 | ||
| 717 | for p in [51, 52] { | 698 | for p in [51, 52] { |
| 718 | shutdown_relay(8000 + p)?; | 699 | shutdown_relay(8000 + p)?; |
| 719 | } | 700 | } |
| 720 | 701 | ||
| 721 | let mut p = CliTester::new(["login", "--password", TEST_PASSWORD]); | 702 | let mut p = CliTester::new(["login", "--password", TEST_PASSWORD]); |
| 722 | 703 | ||
| 723 | p.expect("searching for profile and relay updates...\r\n")?; | 704 | p.expect("searching for profile and relay updates...\r\n")?; |
| 724 | 705 | ||
| 725 | p.expect_end_eventually_with("logged in as fred\r\n")?; | 706 | p.expect_end_eventually_with("logged in as fred\r\n")?; |
| 726 | 707 | ||
| 727 | Ok(()) | 708 | Ok(()) |
| 728 | }) | ||
| 729 | }); | 709 | }); |
| 730 | 710 | ||
| 731 | // launch relay | 711 | // launch relay |
| @@ -754,26 +734,24 @@ mod with_relays { | |||
| 754 | ); | 734 | ); |
| 755 | 735 | ||
| 756 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 736 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 757 | with_fresh_config(|| { | 737 | let mut p = CliTester::new(["login"]); |
| 758 | let mut p = CliTester::new(["login"]); | ||
| 759 | 738 | ||
| 760 | p.expect_input(EXPECTED_NSEC_PROMPT)? | 739 | p.expect_input(EXPECTED_NSEC_PROMPT)? |
| 761 | .succeeds_with(TEST_KEY_1_NSEC)?; | 740 | .succeeds_with(TEST_KEY_1_NSEC)?; |
| 762 | 741 | ||
| 763 | p.expect_confirm(EXPECTED_LOCAL_REPOSITORY_PROMPT, Some(false))? | 742 | p.expect_confirm(EXPECTED_LOCAL_REPOSITORY_PROMPT, Some(false))? |
| 764 | .succeeds_with(Some(true))?; | 743 | .succeeds_with(Some(true))?; |
| 765 | 744 | ||
| 766 | p.expect_confirm(EXPECTED_REQUIRE_PASSWORD_PROMPT, Some(false))? | 745 | p.expect_confirm(EXPECTED_REQUIRE_PASSWORD_PROMPT, Some(false))? |
| 767 | .succeeds_with(Some(false))?; | 746 | .succeeds_with(Some(false))?; |
| 768 | 747 | ||
| 769 | p.expect("searching for profile and relay updates...\r\n")?; | 748 | p.expect("searching for profile and relay updates...\r\n")?; |
| 770 | 749 | ||
| 771 | p.expect_end_with("logged in as fred\r\n")?; | 750 | p.expect_end_with("logged in as fred\r\n")?; |
| 772 | for p in [51, 52, 53, 55] { | 751 | for p in [51, 52, 53, 55] { |
| 773 | shutdown_relay(8000 + p)?; | 752 | shutdown_relay(8000 + p)?; |
| 774 | } | 753 | } |
| 775 | Ok(()) | 754 | Ok(()) |
| 776 | }) | ||
| 777 | }); | 755 | }); |
| 778 | 756 | ||
| 779 | // launch relay | 757 | // launch relay |
| @@ -832,55 +810,50 @@ mod with_offline_flag { | |||
| 832 | #[test] | 810 | #[test] |
| 833 | #[serial] | 811 | #[serial] |
| 834 | fn prompts_for_nsec_and_password() -> Result<()> { | 812 | fn prompts_for_nsec_and_password() -> Result<()> { |
| 835 | before()?; | ||
| 836 | standard_first_time_login_encrypting_nsec()?; | 813 | standard_first_time_login_encrypting_nsec()?; |
| 837 | after() | 814 | Ok(()) |
| 838 | } | 815 | } |
| 839 | 816 | ||
| 840 | #[test] | 817 | #[test] |
| 841 | #[serial] | 818 | #[serial] |
| 842 | fn succeeds_with_text_logged_in_as_npub() -> Result<()> { | 819 | fn succeeds_with_text_logged_in_as_npub() -> Result<()> { |
| 843 | with_fresh_config(|| { | 820 | let mut p = CliTester::new(["login", "--offline"]); |
| 844 | let mut p = CliTester::new(["login", "--offline"]); | ||
| 845 | 821 | ||
| 846 | p.expect_input(EXPECTED_NSEC_PROMPT)? | 822 | p.expect_input(EXPECTED_NSEC_PROMPT)? |
| 847 | .succeeds_with(TEST_KEY_1_NSEC)?; | 823 | .succeeds_with(TEST_KEY_1_NSEC)?; |
| 848 | 824 | ||
| 849 | p.expect_confirm(EXPECTED_LOCAL_REPOSITORY_PROMPT, Some(false))? | 825 | p.expect_confirm(EXPECTED_LOCAL_REPOSITORY_PROMPT, Some(false))? |
| 850 | .succeeds_with(Some(true))?; | 826 | .succeeds_with(Some(true))?; |
| 851 | 827 | ||
| 852 | p.expect_confirm(EXPECTED_REQUIRE_PASSWORD_PROMPT, Some(false))? | 828 | p.expect_confirm(EXPECTED_REQUIRE_PASSWORD_PROMPT, Some(false))? |
| 853 | .succeeds_with(Some(true))?; | 829 | .succeeds_with(Some(true))?; |
| 854 | 830 | ||
| 855 | p.expect_password(EXPECTED_SET_PASSWORD_PROMPT)? | 831 | p.expect_password(EXPECTED_SET_PASSWORD_PROMPT)? |
| 856 | .with_confirmation(EXPECTED_SET_PASSWORD_CONFIRM_PROMPT)? | 832 | .with_confirmation(EXPECTED_SET_PASSWORD_CONFIRM_PROMPT)? |
| 857 | .succeeds_with(TEST_PASSWORD)?; | 833 | .succeeds_with(TEST_PASSWORD)?; |
| 858 | 834 | ||
| 859 | p.expect_end_with(format!("logged in as {}\r\n", TEST_KEY_1_NPUB).as_str()) | 835 | p.expect_end_with(format!("logged in as {}\r\n", TEST_KEY_1_NPUB).as_str()) |
| 860 | }) | ||
| 861 | } | 836 | } |
| 862 | 837 | ||
| 863 | #[test] | 838 | #[test] |
| 864 | #[serial] | 839 | #[serial] |
| 865 | fn succeeds_with_hex_secret_key_in_place_of_nsec() -> Result<()> { | 840 | fn succeeds_with_hex_secret_key_in_place_of_nsec() -> Result<()> { |
| 866 | with_fresh_config(|| { | 841 | let mut p = CliTester::new(["login", "--offline"]); |
| 867 | let mut p = CliTester::new(["login", "--offline"]); | ||
| 868 | 842 | ||
| 869 | p.expect_input(EXPECTED_NSEC_PROMPT)? | 843 | p.expect_input(EXPECTED_NSEC_PROMPT)? |
| 870 | .succeeds_with(TEST_KEY_1_SK_HEX)?; | 844 | .succeeds_with(TEST_KEY_1_SK_HEX)?; |
| 871 | 845 | ||
| 872 | p.expect_confirm(EXPECTED_LOCAL_REPOSITORY_PROMPT, Some(false))? | 846 | p.expect_confirm(EXPECTED_LOCAL_REPOSITORY_PROMPT, Some(false))? |
| 873 | .succeeds_with(Some(true))?; | 847 | .succeeds_with(Some(true))?; |
| 874 | 848 | ||
| 875 | p.expect_confirm(EXPECTED_REQUIRE_PASSWORD_PROMPT, Some(false))? | 849 | p.expect_confirm(EXPECTED_REQUIRE_PASSWORD_PROMPT, Some(false))? |
| 876 | .succeeds_with(Some(true))?; | 850 | .succeeds_with(Some(true))?; |
| 877 | 851 | ||
| 878 | p.expect_password(EXPECTED_SET_PASSWORD_PROMPT)? | 852 | p.expect_password(EXPECTED_SET_PASSWORD_PROMPT)? |
| 879 | .with_confirmation(EXPECTED_SET_PASSWORD_CONFIRM_PROMPT)? | 853 | .with_confirmation(EXPECTED_SET_PASSWORD_CONFIRM_PROMPT)? |
| 880 | .succeeds_with(TEST_PASSWORD)?; | 854 | .succeeds_with(TEST_PASSWORD)?; |
| 881 | 855 | ||
| 882 | p.expect_end_with(format!("logged in as {}\r\n", TEST_KEY_1_NPUB).as_str()) | 856 | p.expect_end_with(format!("logged in as {}\r\n", TEST_KEY_1_NPUB).as_str()) |
| 883 | }) | ||
| 884 | } | 857 | } |
| 885 | 858 | ||
| 886 | mod when_invalid_nsec { | 859 | mod when_invalid_nsec { |
| @@ -889,36 +862,34 @@ mod with_offline_flag { | |||
| 889 | #[test] | 862 | #[test] |
| 890 | #[serial] | 863 | #[serial] |
| 891 | fn prompts_for_nsec_until_valid() -> Result<()> { | 864 | fn prompts_for_nsec_until_valid() -> Result<()> { |
| 892 | with_fresh_config(|| { | 865 | let invalid_nsec_response = |
| 893 | let invalid_nsec_response = | 866 | "invalid nsec. try again with nsec (or hex private key)"; |
| 894 | "invalid nsec. try again with nsec (or hex private key)"; | ||
| 895 | 867 | ||
| 896 | let mut p = CliTester::new(["login", "--offline"]); | 868 | let mut p = CliTester::new(["login", "--offline"]); |
| 897 | 869 | ||
| 898 | p.expect_input(EXPECTED_NSEC_PROMPT)? | 870 | p.expect_input(EXPECTED_NSEC_PROMPT)? |
| 899 | // this behaviour is intentional. rejecting the response with dialoguer | 871 | // this behaviour is intentional. rejecting the response with dialoguer |
| 900 | // hides the original input from the user so they | 872 | // hides the original input from the user so they |
| 901 | // cannot see the mistake they made. | 873 | // cannot see the mistake they made. |
| 902 | .succeeds_with(TEST_INVALID_NSEC)?; | 874 | .succeeds_with(TEST_INVALID_NSEC)?; |
| 903 | 875 | ||
| 904 | p.expect_input(invalid_nsec_response)? | 876 | p.expect_input(invalid_nsec_response)? |
| 905 | .succeeds_with(TEST_INVALID_NSEC)?; | 877 | .succeeds_with(TEST_INVALID_NSEC)?; |
| 906 | 878 | ||
| 907 | p.expect_input(invalid_nsec_response)? | 879 | p.expect_input(invalid_nsec_response)? |
| 908 | .succeeds_with(TEST_KEY_1_NSEC)?; | 880 | .succeeds_with(TEST_KEY_1_NSEC)?; |
| 909 | 881 | ||
| 910 | p.expect_confirm(EXPECTED_LOCAL_REPOSITORY_PROMPT, Some(false))? | 882 | p.expect_confirm(EXPECTED_LOCAL_REPOSITORY_PROMPT, Some(false))? |
| 911 | .succeeds_with(Some(true))?; | 883 | .succeeds_with(Some(true))?; |
| 912 | 884 | ||
| 913 | p.expect_confirm(EXPECTED_REQUIRE_PASSWORD_PROMPT, Some(false))? | 885 | p.expect_confirm(EXPECTED_REQUIRE_PASSWORD_PROMPT, Some(false))? |
| 914 | .succeeds_with(Some(true))?; | 886 | .succeeds_with(Some(true))?; |
| 915 | 887 | ||
| 916 | p.expect_password(EXPECTED_SET_PASSWORD_PROMPT)? | 888 | p.expect_password(EXPECTED_SET_PASSWORD_PROMPT)? |
| 917 | .with_confirmation(EXPECTED_SET_PASSWORD_CONFIRM_PROMPT)? | 889 | .with_confirmation(EXPECTED_SET_PASSWORD_CONFIRM_PROMPT)? |
| 918 | .succeeds_with(TEST_PASSWORD)?; | 890 | .succeeds_with(TEST_PASSWORD)?; |
| 919 | 891 | ||
| 920 | p.expect_end_with(format!("logged in as {}\r\n", TEST_KEY_1_NPUB).as_str()) | 892 | p.expect_end_with(format!("logged in as {}\r\n", TEST_KEY_1_NPUB).as_str()) |
| 921 | }) | ||
| 922 | } | 893 | } |
| 923 | } | 894 | } |
| 924 | } | 895 | } |
| @@ -929,26 +900,22 @@ mod with_offline_flag { | |||
| 929 | #[test] | 900 | #[test] |
| 930 | #[serial] | 901 | #[serial] |
| 931 | fn valid_nsec_param_succeeds_without_prompts() -> Result<()> { | 902 | fn valid_nsec_param_succeeds_without_prompts() -> Result<()> { |
| 932 | with_fresh_config(|| { | 903 | CliTester::new(["login", "--offline", "--nsec", TEST_KEY_1_NSEC]) |
| 933 | CliTester::new(["login", "--offline", "--nsec", TEST_KEY_1_NSEC]) | 904 | .expect_end_with(format!("logged in as {}\r\n", TEST_KEY_1_NPUB).as_str()) |
| 934 | .expect_end_with(format!("logged in as {}\r\n", TEST_KEY_1_NPUB).as_str()) | ||
| 935 | }) | ||
| 936 | } | 905 | } |
| 937 | 906 | ||
| 938 | #[test] | 907 | #[test] |
| 939 | #[serial] | 908 | #[serial] |
| 940 | fn forgets_identity() -> Result<()> { | 909 | fn forgets_identity() -> Result<()> { |
| 941 | with_fresh_config(|| { | 910 | CliTester::new(["login", "--offline", "--nsec", TEST_KEY_1_NSEC]) |
| 942 | CliTester::new(["login", "--offline", "--nsec", TEST_KEY_1_NSEC]) | 911 | .expect_end_with(format!("logged in as {}\r\n", TEST_KEY_1_NPUB).as_str())?; |
| 943 | .expect_end_with(format!("logged in as {}\r\n", TEST_KEY_1_NPUB).as_str())?; | ||
| 944 | 912 | ||
| 945 | let mut p = CliTester::new(["login", "--offline"]); | 913 | let mut p = CliTester::new(["login", "--offline"]); |
| 946 | 914 | ||
| 947 | p.expect_input(EXPECTED_NSEC_PROMPT)? | 915 | p.expect_input(EXPECTED_NSEC_PROMPT)? |
| 948 | .succeeds_with(TEST_KEY_1_NSEC)?; | 916 | .succeeds_with(TEST_KEY_1_NSEC)?; |
| 949 | 917 | ||
| 950 | p.exit() | 918 | p.exit() |
| 951 | }) | ||
| 952 | } | 919 | } |
| 953 | 920 | ||
| 954 | mod when_logging_in_as_different_nsec { | 921 | mod when_logging_in_as_different_nsec { |
| @@ -957,22 +924,18 @@ mod with_offline_flag { | |||
| 957 | #[test] | 924 | #[test] |
| 958 | #[serial] | 925 | #[serial] |
| 959 | fn valid_nsec_param_succeeds_without_prompts_and_logs_in() -> Result<()> { | 926 | fn valid_nsec_param_succeeds_without_prompts_and_logs_in() -> Result<()> { |
| 960 | with_fresh_config(|| { | 927 | standard_first_time_login_encrypting_nsec()?.exit()?; |
| 961 | standard_first_time_login_encrypting_nsec()?.exit()?; | ||
| 962 | 928 | ||
| 963 | CliTester::new(["login", "--offline", "--nsec", TEST_KEY_2_NSEC]) | 929 | CliTester::new(["login", "--offline", "--nsec", TEST_KEY_2_NSEC]) |
| 964 | .expect_end_with(format!("logged in as {}\r\n", TEST_KEY_2_NPUB).as_str()) | 930 | .expect_end_with(format!("logged in as {}\r\n", TEST_KEY_2_NPUB).as_str()) |
| 965 | }) | ||
| 966 | } | 931 | } |
| 967 | } | 932 | } |
| 968 | #[test] | 933 | #[test] |
| 969 | #[serial] | 934 | #[serial] |
| 970 | fn invalid_nsec_param_fails_without_prompts() -> Result<()> { | 935 | fn invalid_nsec_param_fails_without_prompts() -> Result<()> { |
| 971 | with_fresh_config(|| { | 936 | CliTester::new(["login", "--offline", "--nsec", TEST_INVALID_NSEC]).expect_end_with( |
| 972 | CliTester::new(["login", "--offline", "--nsec", TEST_INVALID_NSEC]).expect_end_with( | 937 | "Error: invalid nsec parameter\r\n\r\nCaused by:\r\n Invalid secret key\r\n", |
| 973 | "Error: invalid nsec parameter\r\n\r\nCaused by:\r\n Invalid secret key\r\n", | 938 | ) |
| 974 | ) | ||
| 975 | }) | ||
| 976 | } | 939 | } |
| 977 | } | 940 | } |
| 978 | 941 | ||
| @@ -982,33 +945,29 @@ mod with_offline_flag { | |||
| 982 | #[test] | 945 | #[test] |
| 983 | #[serial] | 946 | #[serial] |
| 984 | fn valid_nsec_param_succeeds_without_prompts() -> Result<()> { | 947 | fn valid_nsec_param_succeeds_without_prompts() -> Result<()> { |
| 985 | with_fresh_config(|| { | 948 | CliTester::new([ |
| 986 | CliTester::new([ | 949 | "login", |
| 987 | "login", | 950 | "--offline", |
| 988 | "--offline", | 951 | "--nsec", |
| 989 | "--nsec", | 952 | TEST_KEY_1_NSEC, |
| 990 | TEST_KEY_1_NSEC, | 953 | "--password", |
| 991 | "--password", | 954 | TEST_PASSWORD, |
| 992 | TEST_PASSWORD, | 955 | ]) |
| 993 | ]) | 956 | .expect_end_with(format!("logged in as {}\r\n", TEST_KEY_1_NPUB).as_str()) |
| 994 | .expect_end_with(format!("logged in as {}\r\n", TEST_KEY_1_NPUB).as_str()) | ||
| 995 | }) | ||
| 996 | } | 957 | } |
| 997 | 958 | ||
| 998 | #[test] | 959 | #[test] |
| 999 | #[serial] | 960 | #[serial] |
| 1000 | fn parameters_can_be_called_globally() -> Result<()> { | 961 | fn parameters_can_be_called_globally() -> Result<()> { |
| 1001 | with_fresh_config(|| { | 962 | CliTester::new([ |
| 1002 | CliTester::new([ | 963 | "--nsec", |
| 1003 | "--nsec", | 964 | TEST_KEY_1_NSEC, |
| 1004 | TEST_KEY_1_NSEC, | 965 | "--password", |
| 1005 | "--password", | 966 | TEST_PASSWORD, |
| 1006 | TEST_PASSWORD, | 967 | "login", |
| 1007 | "login", | 968 | "--offline", |
| 1008 | "--offline", | 969 | ]) |
| 1009 | ]) | 970 | .expect_end_with(format!("logged in as {}\r\n", TEST_KEY_1_NPUB).as_str()) |
| 1010 | .expect_end_with(format!("logged in as {}\r\n", TEST_KEY_1_NPUB).as_str()) | ||
| 1011 | }) | ||
| 1012 | } | 971 | } |
| 1013 | 972 | ||
| 1014 | mod when_logging_in_as_different_nsec { | 973 | mod when_logging_in_as_different_nsec { |
| @@ -1017,19 +976,17 @@ mod with_offline_flag { | |||
| 1017 | #[test] | 976 | #[test] |
| 1018 | #[serial] | 977 | #[serial] |
| 1019 | fn valid_nsec_param_succeeds_without_prompts_and_logs_in() -> Result<()> { | 978 | fn valid_nsec_param_succeeds_without_prompts_and_logs_in() -> Result<()> { |
| 1020 | with_fresh_config(|| { | 979 | standard_first_time_login_encrypting_nsec()?.exit()?; |
| 1021 | standard_first_time_login_encrypting_nsec()?.exit()?; | 980 | |
| 1022 | 981 | CliTester::new([ | |
| 1023 | CliTester::new([ | 982 | "login", |
| 1024 | "login", | 983 | "--offline", |
| 1025 | "--offline", | 984 | "--nsec", |
| 1026 | "--nsec", | 985 | TEST_KEY_2_NSEC, |
| 1027 | TEST_KEY_2_NSEC, | 986 | "--password", |
| 1028 | "--password", | 987 | TEST_PASSWORD, |
| 1029 | TEST_PASSWORD, | 988 | ]) |
| 1030 | ]) | 989 | .expect_end_with(format!("logged in as {}\r\n", TEST_KEY_2_NPUB).as_str()) |
| 1031 | .expect_end_with(format!("logged in as {}\r\n", TEST_KEY_2_NPUB).as_str()) | ||
| 1032 | }) | ||
| 1033 | } | 990 | } |
| 1034 | } | 991 | } |
| 1035 | 992 | ||
| @@ -1039,41 +996,37 @@ mod with_offline_flag { | |||
| 1039 | #[test] | 996 | #[test] |
| 1040 | #[serial] | 997 | #[serial] |
| 1041 | fn password_changes() -> Result<()> { | 998 | fn password_changes() -> Result<()> { |
| 1042 | with_fresh_config(|| { | 999 | standard_first_time_login_encrypting_nsec()?.exit()?; |
| 1043 | standard_first_time_login_encrypting_nsec()?.exit()?; | ||
| 1044 | |||
| 1045 | CliTester::new([ | ||
| 1046 | "login", | ||
| 1047 | "--offline", | ||
| 1048 | "--nsec", | ||
| 1049 | TEST_KEY_1_NSEC, | ||
| 1050 | "--password", | ||
| 1051 | TEST_INVALID_PASSWORD, | ||
| 1052 | ]) | ||
| 1053 | .expect_end_with(format!("logged in as {}\r\n", TEST_KEY_1_NPUB).as_str())?; | ||
| 1054 | |||
| 1055 | CliTester::new(["--password", TEST_INVALID_PASSWORD, "login", "--offline"]) | ||
| 1056 | .expect_end_with(format!("logged in as {}\r\n", TEST_KEY_1_NPUB).as_str()) | ||
| 1057 | }) | ||
| 1058 | } | ||
| 1059 | } | ||
| 1060 | 1000 | ||
| 1061 | #[test] | ||
| 1062 | #[serial] | ||
| 1063 | fn invalid_nsec_param_fails_without_prompts() -> Result<()> { | ||
| 1064 | with_fresh_config(|| { | ||
| 1065 | CliTester::new([ | 1001 | CliTester::new([ |
| 1066 | "login", | 1002 | "login", |
| 1067 | "--offline", | 1003 | "--offline", |
| 1068 | "--nsec", | 1004 | "--nsec", |
| 1069 | TEST_INVALID_NSEC, | 1005 | TEST_KEY_1_NSEC, |
| 1070 | "--password", | 1006 | "--password", |
| 1071 | TEST_PASSWORD, | 1007 | TEST_INVALID_PASSWORD, |
| 1072 | ]) | 1008 | ]) |
| 1073 | .expect_end_with( | 1009 | .expect_end_with(format!("logged in as {}\r\n", TEST_KEY_1_NPUB).as_str())?; |
| 1074 | "Error: invalid nsec parameter\r\n\r\nCaused by:\r\n Invalid secret key\r\n", | 1010 | |
| 1075 | ) | 1011 | CliTester::new(["--password", TEST_INVALID_PASSWORD, "login", "--offline"]) |
| 1076 | }) | 1012 | .expect_end_with(format!("logged in as {}\r\n", TEST_KEY_1_NPUB).as_str()) |
| 1013 | } | ||
| 1014 | } | ||
| 1015 | |||
| 1016 | #[test] | ||
| 1017 | #[serial] | ||
| 1018 | fn invalid_nsec_param_fails_without_prompts() -> Result<()> { | ||
| 1019 | CliTester::new([ | ||
| 1020 | "login", | ||
| 1021 | "--offline", | ||
| 1022 | "--nsec", | ||
| 1023 | TEST_INVALID_NSEC, | ||
| 1024 | "--password", | ||
| 1025 | TEST_PASSWORD, | ||
| 1026 | ]) | ||
| 1027 | .expect_end_with( | ||
| 1028 | "Error: invalid nsec parameter\r\n\r\nCaused by:\r\n Invalid secret key\r\n", | ||
| 1029 | ) | ||
| 1077 | } | 1030 | } |
| 1078 | } | 1031 | } |
| 1079 | 1032 | ||
| @@ -1085,40 +1038,38 @@ mod with_offline_flag { | |||
| 1085 | // combined into a single test as it is computationally expensive to run | 1038 | // combined into a single test as it is computationally expensive to run |
| 1086 | fn warns_it_might_take_a_few_seconds_then_succeeds_then_second_login_prompts_for_password_then_warns_again_then_succeeds() | 1039 | fn warns_it_might_take_a_few_seconds_then_succeeds_then_second_login_prompts_for_password_then_warns_again_then_succeeds() |
| 1087 | -> Result<()> { | 1040 | -> Result<()> { |
| 1088 | with_fresh_config(|| { | 1041 | let mut p = CliTester::new_with_timeout(10000, ["login", "--offline"]); |
| 1089 | let mut p = CliTester::new_with_timeout(10000, ["login", "--offline"]); | 1042 | p.expect_input(EXPECTED_NSEC_PROMPT)? |
| 1090 | p.expect_input(EXPECTED_NSEC_PROMPT)? | 1043 | .succeeds_with(TEST_KEY_1_NSEC)?; |
| 1091 | .succeeds_with(TEST_KEY_1_NSEC)?; | ||
| 1092 | 1044 | ||
| 1093 | p.expect_confirm(EXPECTED_LOCAL_REPOSITORY_PROMPT, Some(false))? | 1045 | p.expect_confirm(EXPECTED_LOCAL_REPOSITORY_PROMPT, Some(false))? |
| 1094 | .succeeds_with(Some(true))?; | 1046 | .succeeds_with(Some(true))?; |
| 1095 | 1047 | ||
| 1096 | p.expect_confirm(EXPECTED_REQUIRE_PASSWORD_PROMPT, Some(false))? | 1048 | p.expect_confirm(EXPECTED_REQUIRE_PASSWORD_PROMPT, Some(false))? |
| 1097 | .succeeds_with(Some(true))?; | 1049 | .succeeds_with(Some(true))?; |
| 1098 | 1050 | ||
| 1099 | p.expect_password(EXPECTED_SET_PASSWORD_PROMPT)? | 1051 | p.expect_password(EXPECTED_SET_PASSWORD_PROMPT)? |
| 1100 | .with_confirmation(EXPECTED_SET_PASSWORD_CONFIRM_PROMPT)? | 1052 | .with_confirmation(EXPECTED_SET_PASSWORD_CONFIRM_PROMPT)? |
| 1101 | .succeeds_with(TEST_WEAK_PASSWORD)?; | 1053 | .succeeds_with(TEST_WEAK_PASSWORD)?; |
| 1102 | 1054 | ||
| 1103 | p.expect("this may take a few seconds...\r\n")?; | 1055 | p.expect("this may take a few seconds...\r\n")?; |
| 1104 | 1056 | ||
| 1105 | p.expect_end_with(format!("logged in as {}\r\n", TEST_KEY_1_NPUB).as_str()) | 1057 | p.expect_end_with(format!("logged in as {}\r\n", TEST_KEY_1_NPUB).as_str()) |
| 1106 | 1058 | ||
| 1107 | // commented out as 'login' command now assumes you want to | 1059 | // commented out as 'login' command now assumes you want to |
| 1108 | // login as a new user | 1060 | // login as a new user |
| 1109 | // p = CliTester::new_with_timeout(10000, ["login", | 1061 | // p = CliTester::new_with_timeout(10000, ["login", |
| 1110 | // "--offline"]); | 1062 | // "--offline"]); |
| 1111 | 1063 | ||
| 1112 | // p.expect(format!("login as {}\r\n", | 1064 | // p.expect(format!("login as {}\r\n", |
| 1113 | // TEST_KEY_1_NPUB).as_str())? | 1065 | // TEST_KEY_1_NPUB).as_str())? |
| 1114 | // .expect_password(EXPECTED_PASSWORD_PROMPT)? | 1066 | // .expect_password(EXPECTED_PASSWORD_PROMPT)? |
| 1115 | // .succeeds_with(TEST_WEAK_PASSWORD)?; | 1067 | // .succeeds_with(TEST_WEAK_PASSWORD)?; |
| 1116 | 1068 | ||
| 1117 | // p.expect("this may take a few seconds...\r\n")?; | 1069 | // p.expect("this may take a few seconds...\r\n")?; |
| 1118 | 1070 | ||
| 1119 | // p.expect_end_with(format!("logged in as {}\r\n", | 1071 | // p.expect_end_with(format!("logged in as {}\r\n", |
| 1120 | // TEST_KEY_1_NPUB).as_str()) | 1072 | // TEST_KEY_1_NPUB).as_str()) |
| 1121 | }) | ||
| 1122 | } | 1073 | } |
| 1123 | } | 1074 | } |
| 1124 | } | 1075 | } |