upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/test_utils/src
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2023-11-01 00:00:00 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2023-11-01 00:00:00 +0000
commit57321aa9136293b24757a6695a5c92087af539ab (patch)
tree2867d02430e346b13f7abcbb1022113d4fac31fa /test_utils/src
parent82f1ba360b60c8339c7caea0dec7903ee5e764cd (diff)
feat(prs-create) send to repo relays
fetch repository reference events to identify repository relays send pr events to repository relays alongside user relays
Diffstat (limited to 'test_utils/src')
-rw-r--r--test_utils/src/lib.rs23
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};
3use anyhow::{ensure, Context, Result}; 3use anyhow::{ensure, Context, Result};
4use dialoguer::theme::{ColorfulTheme, Theme}; 4use dialoguer::theme::{ColorfulTheme, Theme};
5use directories::ProjectDirs; 5use directories::ProjectDirs;
6use nostr::{self, prelude::FromSkStr}; 6use nostr::{self, prelude::FromSkStr, Tag};
7use once_cell::sync::Lazy; 7use once_cell::sync::Lazy;
8use rexpect::session::{Options, PtySession}; 8use rexpect::session::{Options, PtySession};
9use strip_ansi_escapes::strip_str; 9use 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
123pub static REPOSITORY_KIND: u64 = 300317;
124
125pub 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