aboutsummaryrefslogtreecommitdiff
path: root/src/test.rs
diff options
context:
space:
mode:
authorKunoiSayami <[email protected]>2026-06-11 14:53:23 +0800
committerKunoiSayami <[email protected]>2026-06-11 14:53:23 +0800
commit9e67f120b797bae10bd226bbb4632f8d19a24361 (patch)
treed94a9a067eb05cf78bee7282ff7c9f093c360bfc /src/test.rs
parentc708a63f7e5b9b22f8095ede0be56115eccbbac8 (diff)
fix: Fix OsRng import and refactor Redis connection setup
- Fix password-hash version mismatch (0.6→0.5) causing OsRng to be gated behind missing getrandom feature; enable argon2 rand feature - Extract get_redis_connection() helper to deduplicate Redis client setup across authentication, repo control, and tests - Tighten username validation regex to require ≥2 chars and disallow leading/trailing dots or hyphens - Handle malformed cookies without split_once gracefully (continue instead of panic) - Fix typos: "rated commands" → "related commands" in CLI help text Co-Authored-By: Claude Sonnet 4.6 <[email protected]> Signed-off-by: KunoiSayami <[email protected]>
Diffstat (limited to 'src/test.rs')
-rw-r--r--src/test.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/test.rs b/src/test.rs
index 7628921..e71aee4 100644
--- a/src/test.rs
+++ b/src/test.rs
@@ -55,8 +55,9 @@ mod core {
}
async fn async_test_redis() -> anyhow::Result<()> {
- let redis_conn = redis::Client::open(crate::datastructures::DEFAULT_REDIS_URL)?;
- let mut conn = redis_conn.get_multiplexed_async_connection().await?;
+ let mut conn =
+ crate::datastructures::get_redis_connection(crate::datastructures::DEFAULT_REDIS_URL)
+ .await?;
let s = rand_str(crate::datastructures::COOKIE_LENGTH);
conn.set_ex::<_, _, String>("auth_test", &s, 60).await?;
@@ -344,8 +345,9 @@ mod core {
}
async fn clear_redis_setting() -> anyhow::Result<()> {
- let client = redis::Client::open(crate::datastructures::DEFAULT_REDIS_URL)?;
- let mut conn = client.get_multiplexed_async_connection().await?;
+ let mut conn =
+ crate::datastructures::get_redis_connection(crate::datastructures::DEFAULT_REDIS_URL)
+ .await?;
for key in &[
"cgit_repo_test",