diff options
Diffstat (limited to 'test_utils/src')
| -rw-r--r-- | test_utils/src/lib.rs | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/test_utils/src/lib.rs b/test_utils/src/lib.rs index 3cb5d65..e867a7b 100644 --- a/test_utils/src/lib.rs +++ b/test_utils/src/lib.rs | |||
| @@ -3,7 +3,7 @@ use std::{ffi::OsStr, path::PathBuf}; | |||
| 3 | use anyhow::{ensure, Context, Result}; | 3 | use anyhow::{ensure, Context, Result}; |
| 4 | use dialoguer::theme::{ColorfulTheme, Theme}; | 4 | use dialoguer::theme::{ColorfulTheme, Theme}; |
| 5 | use directories::ProjectDirs; | 5 | use directories::ProjectDirs; |
| 6 | use nostr::{self, prelude::FromSkStr}; | 6 | use nostr::{self, prelude::FromSkStr, Tag}; |
| 7 | use once_cell::sync::Lazy; | 7 | use once_cell::sync::Lazy; |
| 8 | use rexpect::session::{Options, PtySession}; | 8 | use rexpect::session::{Options, PtySession}; |
| 9 | use strip_ansi_escapes::strip_str; | 9 | use strip_ansi_escapes::strip_str; |
| @@ -120,6 +120,27 @@ pub fn make_event_old_or_change_user( | |||
| 120 | unsigned.sign(keys).unwrap() | 120 | unsigned.sign(keys).unwrap() |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | pub static REPOSITORY_KIND: u64 = 300317; | ||
| 124 | |||
| 125 | pub fn generate_repo_ref_event() -> nostr::Event { | ||
| 126 | // taken from test git_repo | ||
| 127 | let root_commit = "9ee507fc4357d7ee16a5d8901bedcd103f23c17d"; | ||
| 128 | nostr::event::EventBuilder::new( | ||
| 129 | nostr::Kind::Custom(REPOSITORY_KIND), | ||
| 130 | "", | ||
| 131 | &[ | ||
| 132 | Tag::Identifier(root_commit.to_string()), | ||
| 133 | Tag::Reference(format!("r-{}", root_commit)), | ||
| 134 | Tag::Name("example name".to_string()), | ||
| 135 | Tag::Description("example description".to_string()), | ||
| 136 | Tag::Relay("ws://localhost:8055".into()), | ||
| 137 | Tag::Relay("ws://localhost:8056".into()), | ||
| 138 | ], | ||
| 139 | ) | ||
| 140 | .to_event(&TEST_KEY_1_KEYS) | ||
| 141 | .unwrap() | ||
| 142 | } | ||
| 143 | |||
| 123 | /// wrapper for a cli testing tool - currently wraps rexpect and dialoguer | 144 | /// wrapper for a cli testing tool - currently wraps rexpect and dialoguer |
| 124 | /// | 145 | /// |
| 125 | /// 1. allow more accurate articulation of expected behaviour | 146 | /// 1. allow more accurate articulation of expected behaviour |