fixes capitalization issue; modifies existing test to check for it (#841)

This commit is contained in:
Wyatt Verchere 2024-01-09 12:42:17 -08:00 committed by GitHub
parent d51d6517be
commit 3464fbb2e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 7 deletions

View File

@ -97,7 +97,7 @@ pub async fn index_projects(
let id_chunk = id_chunk
.into_iter()
.map(|(version_id, project_id, owner_username)| {
(version_id, (project_id, owner_username.to_lowercase()))
(version_id, (project_id, owner_username))
})
.collect::<HashMap<_, _>>();
let uploads = index_local(&pool, &redis, id_chunk).await?;

View File

@ -27,7 +27,7 @@ use super::{
use super::{database::USER_USER_ID, get_json_val_str};
pub const DUMMY_DATA_UPDATE: i64 = 6;
pub const DUMMY_DATA_UPDATE: i64 = 7;
#[allow(dead_code)]
pub const DUMMY_CATEGORIES: &[&str] = &[

View File

@ -4,11 +4,11 @@
-- Inserts 5 dummy users for testing, with slight differences
-- 'Friend' and 'enemy' function like 'user', but we can use them to simulate 'other' users that may or may not be able to access certain things
-- IDs 1-5, 1-5
INSERT INTO users (id, username, name, email, role) VALUES (1, 'admin', 'Administrator Test', 'admin@modrinth.com', 'admin');
INSERT INTO users (id, username, name, email, role) VALUES (2, 'moderator', 'Moderator Test', 'moderator@modrinth.com', 'moderator');
INSERT INTO users (id, username, name, email, role) VALUES (3, 'user', 'User Test', 'user@modrinth.com', 'developer');
INSERT INTO users (id, username, name, email, role) VALUES (4, 'friend', 'Friend Test', 'friend@modrinth.com', 'developer');
INSERT INTO users (id, username, name, email, role) VALUES (5, 'enemy', 'Enemy Test', 'enemy@modrinth.com', 'developer');
INSERT INTO users (id, username, name, email, role) VALUES (1, 'Admin', 'Administrator Test', 'admin@modrinth.com', 'admin');
INSERT INTO users (id, username, name, email, role) VALUES (2, 'Moderator', 'Moderator Test', 'moderator@modrinth.com', 'moderator');
INSERT INTO users (id, username, name, email, role) VALUES (3, 'User', 'User Test', 'user@modrinth.com', 'developer');
INSERT INTO users (id, username, name, email, role) VALUES (4, 'Friend', 'Friend Test', 'friend@modrinth.com', 'developer');
INSERT INTO users (id, username, name, email, role) VALUES (5, 'Enemy', 'Enemy Test', 'enemy@modrinth.com', 'developer');
-- Full PATs for each user, with different scopes
-- These are not legal PATs, as they contain all scopes- they mimic permissions of a logged in user

View File

@ -391,6 +391,7 @@ async fn search_projects() {
.await;
for hit in game_versions.hits {
assert_eq!(hit.versions, vec!["1.20.5".to_string()]);
assert_eq!(hit.author, "User".to_string());
}
})
.await;