common: enhance user repository with validation

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Ic96bef36e3b4d1ea6b2db9752b26dd3a6a6a6964
This commit is contained in:
raf 2026-02-07 20:04:30 +03:00
commit caadb52f64
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
3 changed files with 131 additions and 26 deletions

View file

@ -500,8 +500,12 @@ mod tests {
#[test]
fn test_create_evaluation_valid() {
let e = CreateEvaluation {
jobset_id: Uuid::new_v4(),
commit_hash: "abc123".to_string(),
jobset_id: Uuid::new_v4(),
commit_hash: "abc123".to_string(),
pr_number: None,
pr_head_branch: None,
pr_base_branch: None,
pr_action: None,
};
assert!(e.validate().is_ok());
}
@ -509,8 +513,12 @@ mod tests {
#[test]
fn test_create_evaluation_invalid_hash() {
let e = CreateEvaluation {
jobset_id: Uuid::new_v4(),
commit_hash: "not-hex!".to_string(),
jobset_id: Uuid::new_v4(),
commit_hash: "not-hex!".to_string(),
pr_number: None,
pr_head_branch: None,
pr_base_branch: None,
pr_action: None,
};
assert!(e.validate().is_err());
}