Commit 2e4eaad6 authored by Levente Polyak's avatar Levente Polyak
Browse files

api/projects: allow label endpoint to query by name

parent c99e1d44
......@@ -6,6 +6,8 @@
to include member details for those members that have access as a result
of belonging to ancestor/enclosing groups, in addition to directly added
members.
* Allow a label via the `api::projects::labels::Label` endpoint to be queried
by id or name.
## Additions
......
......@@ -16,8 +16,9 @@ pub struct Label<'a> {
/// The project to query for the label.
#[builder(setter(into))]
project: NameOrId<'a>,
/// The ID of the label.
label: u64,
/// The ID or title of the label.
#[builder(setter(into))]
label: NameOrId<'a>,
/// Include ancestor groups.
///
......@@ -80,6 +81,20 @@ mod tests {
Label::builder().project(1).label(1).build().unwrap();
}
#[test]
fn label_by_id() {
Label::builder().project(1).label(1).build().unwrap();
}
#[test]
fn label_by_name() {
Label::builder()
.project(1)
.label("label_name")
.build()
.unwrap();
}
#[test]
fn endpoint() {
let endpoint = ExpectedUrl::builder()
......@@ -113,4 +128,20 @@ mod tests {
.unwrap();
api::ignore(endpoint).query(&client).unwrap();
}
#[test]
fn endpoint_escapes_label_name() {
let endpoint = ExpectedUrl::builder()
.endpoint("projects/simple%2Fproject/labels/simple%2Flabel")
.build()
.unwrap();
let client = SingleTestClient::new_raw(endpoint, "");
let endpoint = Label::builder()
.project("simple/project")
.label("simple/label")
.build()
.unwrap();
api::ignore(endpoint).query(&client).unwrap();
}
}
Markdown is supported
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