Verified Commit 609e6d71 authored by Leonidas Spyropoulos's avatar Leonidas Spyropoulos
Browse files

fix: add new user bot for aurweb-errors project

parent caa97838
Pipeline #15986 passed with stages
in 2 minutes and 29 seconds
......@@ -7,13 +7,16 @@ else
CARGO_OPTIONS :=
endif
.PHONY: all gluebuddy lint
.PHONY: all gluebuddy test lint
all: gluebuddy lint
all: gluebuddy test lint
gluebuddy:
$(CARGO) build $(CARGO_OPTIONS)
test:
$(CARGO) test $(CARGO_OPTIONS)
lint:
$(CARGO) fmt -- --check
$(CARGO) check
......
......@@ -834,6 +834,7 @@ fn is_archlinux_bot(member: &GitLabMember) -> bool {
if vec![
"project_10185_bot2".to_string(),
"project_19591_bot".to_string(),
"project_19796_bot".to_string(),
]
.contains(&member.username)
{
......@@ -918,3 +919,30 @@ fn protect_tag(client: &Gitlab, project: &GroupProjects, tag: &str) -> Result<Pr
let result: ProtectedTag = endpoint.query(client)?;
Ok(result)
}
#[cfg(test)]
mod tests {
use super::*;
macro_rules! is_archlinux_bot_tests {
($($name:ident: $value:expr,)*) => {
$(
#[test]
fn $name() {
let (input, _expected) = $value;
let member = GitLabMember { id: 0, username: String::from(input), name: String::from(""), email: Option::None, access_level: 0 };
assert_eq!(is_archlinux_bot(&member), _expected);
}
)*
}
}
is_archlinux_bot_tests! {
is_archlinux_bot_gitlab_owner: (GITLAB_OWNER, true),
is_archlinux_bot_gitlab_bot: (GITLAB_BOT, true),
is_archlinux_bot_project_10185_bot2: ("project_10185_bot2", true),
is_archlinux_bot_project_19591_bot: ("project_19591_bot", true),
is_archlinux_bot_project_19796_bot: ("project_19796_bot", true),
is_archlinux_bot_test: ("test", false),
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment