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>2025-06-02 07:51:22 +0100
committerDanConwayDev <DanConwayDev@protonmail.com>2025-06-02 07:51:22 +0100
commit4625958aa51d3bfc67f89e39fa28b843a1f0ac8e (patch)
tree42c4f1b911a8c3710901ce50274e780950fdd02f /test_utils/src
parentcea93cee5edf67499cbd4be0843b67f68265be3e (diff)
tests: fix tests by adding maintainer ann event
to comply with changes in 5f45edbebe310decb06f955d95665a6ad387c6cb
Diffstat (limited to 'test_utils/src')
-rw-r--r--test_utils/src/lib.rs25
1 files changed, 19 insertions, 6 deletions
diff --git a/test_utils/src/lib.rs b/test_utils/src/lib.rs
index f1939ac..5feb64b 100644
--- a/test_utils/src/lib.rs
+++ b/test_utils/src/lib.rs
@@ -152,6 +152,13 @@ pub fn generate_repo_ref_event() -> nostr::Event {
152} 152}
153 153
154pub fn generate_repo_ref_event_with_git_server(git_servers: Vec<String>) -> nostr::Event { 154pub fn generate_repo_ref_event_with_git_server(git_servers: Vec<String>) -> nostr::Event {
155 generate_repo_ref_event_with_git_server_with_keys(git_servers, &TEST_KEY_1_KEYS)
156}
157
158pub fn generate_repo_ref_event_with_git_server_with_keys(
159 git_servers: Vec<String>,
160 keys: &nostr::Keys,
161) -> nostr::Event {
155 // taken from test git_repo 162 // taken from test git_repo
156 // TODO - this may not be consistant across computers as it might take the 163 // TODO - this may not be consistant across computers as it might take the
157 // author and committer from global git config 164 // author and committer from global git config
@@ -185,16 +192,22 @@ pub fn generate_repo_ref_event_with_git_server(git_servers: Vec<String>) -> nost
185 ), 192 ),
186 Tag::custom( 193 Tag::custom(
187 nostr::TagKind::Custom(std::borrow::Cow::Borrowed("maintainers")), 194 nostr::TagKind::Custom(std::borrow::Cow::Borrowed("maintainers")),
188 vec![ 195 [
189 TEST_KEY_1_KEYS.public_key().to_string(), 196 vec![keys.public_key().to_string()],
190 TEST_KEY_2_KEYS.public_key().to_string(), 197 vec![
191 ], 198 TEST_KEY_1_KEYS.public_key().to_string(),
199 TEST_KEY_2_KEYS.public_key().to_string(),
200 ]
201 .into_iter()
202 .filter(|key| !keys.public_key().to_string().eq(key))
203 .collect(),
204 ]
205 .concat(),
192 ), 206 ),
193 ]) 207 ])
194 .sign_with_keys(&TEST_KEY_1_KEYS) 208 .sign_with_keys(keys)
195 .unwrap() 209 .unwrap()
196} 210}
197
198/// enough to fool event_is_patch_set_root 211/// enough to fool event_is_patch_set_root
199pub fn get_pretend_proposal_root_event() -> nostr::Event { 212pub fn get_pretend_proposal_root_event() -> nostr::Event {
200 serde_json::from_str(r#"{"id":"431e58eb8e1b4e20292d1d5bbe81d5cfb042e1bc165de32eddfdd52245a4cce4","pubkey":"f53e4bcd7a9cdef049cf6467d638a1321958acd3b71eb09823fd6fadb023d768","created_at":1721404213,"kind":1617,"tags":[["a","30617:ba882566eff14f3baa976103998c452d27fe95b65a796a6a9f92628bced76fe5:9ee507fc4357d7ee16a5d8901bedcd103f23c17d-consider-it-random"],["a","30617:f53e4bcd7a9cdef049cf6467d638a1321958acd3b71eb09823fd6fadb023d768:9ee507fc4357d7ee16a5d8901bedcd103f23c17d-consider-it-random"],["r","9ee507fc4357d7ee16a5d8901bedcd103f23c17d"],["t","cover-letter"],["alt","git patch cover letter: exampletitle"],["t","root"],["e","8cb75aa4cda10a3a0f3242dc49d36159d30b3185bf63414cf6ce17f5c14a73b1","","mention"],["branch-name","feature"],["p","ba882566eff14f3baa976103998c452d27fe95b65a796a6a9f92628bced76fe5"],["p","f53e4bcd7a9cdef049cf6467d638a1321958acd3b71eb09823fd6fadb023d768"]],"content":"From fe973a840fba2a8ab37dd505c154854a69a6505c Mon Sep 17 00:00:00 2001\nSubject: [PATCH 0/2] exampletitle\n\nexampledescription","sig":"37d5b2338bf9fd9d598e6494ae88af9a8dbd52330cfe9d025ee55e35e2f3f55e931ba039d9f7fed8e6fc40206e47619a24f730f8eddc2a07ccfb3988a5005170"}"#).unwrap() 213 serde_json::from_str(r#"{"id":"431e58eb8e1b4e20292d1d5bbe81d5cfb042e1bc165de32eddfdd52245a4cce4","pubkey":"f53e4bcd7a9cdef049cf6467d638a1321958acd3b71eb09823fd6fadb023d768","created_at":1721404213,"kind":1617,"tags":[["a","30617:ba882566eff14f3baa976103998c452d27fe95b65a796a6a9f92628bced76fe5:9ee507fc4357d7ee16a5d8901bedcd103f23c17d-consider-it-random"],["a","30617:f53e4bcd7a9cdef049cf6467d638a1321958acd3b71eb09823fd6fadb023d768:9ee507fc4357d7ee16a5d8901bedcd103f23c17d-consider-it-random"],["r","9ee507fc4357d7ee16a5d8901bedcd103f23c17d"],["t","cover-letter"],["alt","git patch cover letter: exampletitle"],["t","root"],["e","8cb75aa4cda10a3a0f3242dc49d36159d30b3185bf63414cf6ce17f5c14a73b1","","mention"],["branch-name","feature"],["p","ba882566eff14f3baa976103998c452d27fe95b65a796a6a9f92628bced76fe5"],["p","f53e4bcd7a9cdef049cf6467d638a1321958acd3b71eb09823fd6fadb023d768"]],"content":"From fe973a840fba2a8ab37dd505c154854a69a6505c Mon Sep 17 00:00:00 2001\nSubject: [PATCH 0/2] exampletitle\n\nexampledescription","sig":"37d5b2338bf9fd9d598e6494ae88af9a8dbd52330cfe9d025ee55e35e2f3f55e931ba039d9f7fed8e6fc40206e47619a24f730f8eddc2a07ccfb3988a5005170"}"#).unwrap()