Rename variable in parse_command test

Rename `map` to `headers` inside the `parse_command` test to improve
readability.
This commit is contained in:
finga 2021-11-05 13:51:31 +01:00
parent 5a88fb892b
commit 87d6f58f72

View file

@ -609,48 +609,53 @@ mod tests {
#[test]
fn parse_command() {
let mut map = HeaderMap::new();
map.add_raw("X-Gitea-Event", "something");
let mut headers = HeaderMap::new();
headers.add_raw("X-Gitea-Event", "something");
assert_eq!(
replace_parameters("command", &map, &serde_json::Value::Null).unwrap(),
replace_parameters("command", &headers, &serde_json::Value::Null).unwrap(),
"command"
);
assert_eq!(
replace_parameters(" command", &map, &serde_json::Value::Null).unwrap(),
replace_parameters(" command", &headers, &serde_json::Value::Null).unwrap(),
" command"
);
assert_eq!(
replace_parameters("command ", &map, &serde_json::Value::Null).unwrap(),
replace_parameters("command ", &headers, &serde_json::Value::Null).unwrap(),
"command "
);
assert_eq!(
replace_parameters(" command ", &map, &serde_json::Value::Null).unwrap(),
replace_parameters(" command ", &headers, &serde_json::Value::Null).unwrap(),
" command "
);
assert_eq!(
replace_parameters("command command ", &map, &serde_json::Value::Null).unwrap(),
replace_parameters("command command ", &headers, &serde_json::Value::Null).unwrap(),
"command command "
);
assert_eq!(
replace_parameters("{{ /foo }} command", &map, &json!({ "foo": "bar" })).unwrap(),
replace_parameters("{{ /foo }} command", &headers, &json!({ "foo": "bar" })).unwrap(),
"bar command"
);
assert_eq!(
replace_parameters(" command {{ /foo }} ", &map, &json!({ "foo": "bar" })).unwrap(),
replace_parameters(
" command {{ /foo }} ",
&headers,
&json!({ "foo": "bar" })
)
.unwrap(),
" command bar "
);
assert_eq!(
replace_parameters(
"{{ /foo }} command{{/field1/foo}}",
&map,
&headers,
&json!({ "foo": "bar", "field1": { "foo": "baz" } })
)
.unwrap(),
@ -658,14 +663,19 @@ mod tests {
);
assert_eq!(
replace_parameters(" command {{ /foo }} ", &map, &json!({ "foo": "bar" })).unwrap(),
replace_parameters(
" command {{ /foo }} ",
&headers,
&json!({ "foo": "bar" })
)
.unwrap(),
" command bar "
);
assert_eq!(
replace_parameters(
" {{ /field1/foo }} command",
&map,
&headers,
&json!({ "field1": { "foo": "bar" } })
)
.unwrap(),
@ -675,7 +685,7 @@ mod tests {
assert_eq!(
replace_parameters(
" {{ header X-Gitea-Event }} command",
&map,
&headers,
&json!({ "field1": { "foo": "bar" } })
)
.unwrap(),