diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-11-06 12:59:29 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-11-06 15:17:32 +0000 |
| commit | 16d14d07b023614c1da0fbb11693d131327a3532 (patch) | |
| tree | c6e4b2fe6bae57bd35e8d526f281a84b515641f2 /grasp-audit/src/client.rs | |
| parent | ad6b8a825a500896d613fed72c11e7cbce3ddfd9 (diff) | |
fix cli runs to prevent rate limiting
Diffstat (limited to 'grasp-audit/src/client.rs')
| -rw-r--r-- | grasp-audit/src/client.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/grasp-audit/src/client.rs b/grasp-audit/src/client.rs index 74a16d8..1f6f0fb 100644 --- a/grasp-audit/src/client.rs +++ b/grasp-audit/src/client.rs | |||
| @@ -13,6 +13,18 @@ pub struct AuditClient { | |||
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | impl AuditClient { | 15 | impl AuditClient { |
| 16 | /// Create a new audit client for testing (no relay connection) | ||
| 17 | #[cfg(test)] | ||
| 18 | pub fn new_test(config: AuditConfig) -> Self { | ||
| 19 | let keys = Keys::generate(); | ||
| 20 | let client = Client::new(keys.clone()); | ||
| 21 | Self { | ||
| 22 | client, | ||
| 23 | config, | ||
| 24 | keys, | ||
| 25 | } | ||
| 26 | } | ||
| 27 | |||
| 16 | /// Create a new audit client | 28 | /// Create a new audit client |
| 17 | pub async fn new(relay_url: &str, config: AuditConfig) -> Result<Self> { | 29 | pub async fn new(relay_url: &str, config: AuditConfig) -> Result<Self> { |
| 18 | let keys = Keys::generate(); | 30 | let keys = Keys::generate(); |
| @@ -216,7 +228,7 @@ impl AuditClient { | |||
| 216 | .replace("wss://", "https://"); | 228 | .replace("wss://", "https://"); |
| 217 | 229 | ||
| 218 | // Create unique repository identifier using UUID for consistency | 230 | // Create unique repository identifier using UUID for consistency |
| 219 | let repo_id = format!("{}-{}", test_name, uuid::Uuid::new_v4()); | 231 | let repo_id = format!("{}-{}", test_name, &uuid::Uuid::new_v4().to_string()[..8]); |
| 220 | 232 | ||
| 221 | // Get npub for clone URL | 233 | // Get npub for clone URL |
| 222 | let npub = self.public_key().to_bech32() | 234 | let npub = self.public_key().to_bech32() |