test(core): add lookup-by-gitlab_project_id test for projects table
Validates that the projects table schema uses gitlab_project_id (not gitlab_id) and that queries filtering by this column return the correct project. Uses the test helper convention where insert_project sets gitlab_project_id = id * 100.
This commit is contained in:
@@ -154,3 +154,25 @@ fn test_percent_not_wildcard() {
|
||||
let id = resolve_project(&conn, "a%b").unwrap();
|
||||
assert_eq!(id, 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_lookup_by_gitlab_project_id() {
|
||||
use crate::test_support::{insert_project as insert_proj, setup_test_db};
|
||||
|
||||
let conn = setup_test_db();
|
||||
insert_proj(&conn, 1, "team/alpha");
|
||||
insert_proj(&conn, 2, "team/beta");
|
||||
|
||||
// insert_project sets gitlab_project_id = id * 100
|
||||
let path: String = conn
|
||||
.query_row(
|
||||
"SELECT path_with_namespace FROM projects
|
||||
WHERE gitlab_project_id = ?1
|
||||
ORDER BY id LIMIT 1",
|
||||
rusqlite::params![200_i64],
|
||||
|row| row.get(0),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(path, "team/beta");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user